From 2f3437fa654f96c150fd44c8a0b9786fa64cc930 Mon Sep 17 00:00:00 2001 From: Daniel Radeau Date: Fri, 6 Feb 2026 17:34:49 +0100 Subject: [PATCH 1/4] story #15307 code: add prettier and license plugins --- LICENSE.txt | 35 +++++++++++++++++++++ pom.xml | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..117cc08f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,35 @@ +Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) +and the signatories of the "VITAM - Accord du Contributeur" agreement. + +contact@programmevitam.fr + +This software is a computer program whose purpose is to provide +tools for construction and manipulation of SIP (Submission +Information Package) conform to the SEDA (Standard d’Échange +de données pour l’Archivage) standard. + +This software is governed by the CeCILL-C license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL-C +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL-C license and that you accept its terms. diff --git a/pom.xml b/pom.xml index bfa0480a..809f8557 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,12 @@ 2.5.2 2.3.0 2.5.0 + + + 3.0 + 2.43.0 + 3.2.4 + 2.6.0 @@ -176,8 +182,92 @@ versions-maven-plugin ${versions.version} + + + org.commonjava.maven.plugins + directory-maven-plugin + 0.1 + + + directories + + highest-basedir + + initialize + + main.basedir + + + + + + + com.mycila + license-maven-plugin + ${license-maven-plugin.version} + +
${maven.multiModuleProjectDirectory}/LICENSE.txt
+ + Vitam + contact@programmevitam.fr + + + src/main/java/**/*.java + src/test/java/**/*.java + + + **/target/** + **/.directory/** + +
+ + + + check + + + +
+ + com.diffplug.spotless + spotless-maven-plugin + ${spotless-maven-plugin.version} + + + + src/main/java/**/*.java + src/test/java/**/*.java + + + + ${spotless-maven-plugin.prettier.version} + ${spotless-maven-plugin.prettier-plugin-java.version} + + + + 120 + 4 + java + prettier-plugin-java + + + + ,javax|java,\# + + + + + + + + check + + + + +
From cb3ead68913f40e8ffff82efdafe3cc92bec383f Mon Sep 17 00:00:00 2001 From: Daniel Radeau Date: Fri, 6 Feb 2026 17:38:47 +0100 Subject: [PATCH 2/4] story #15307 code: apply licenses --- javalibpst/src/main/java/example/Test.java | 37 +++++++++++ javalibpst/src/main/java/example/TestGui.java | 37 +++++++++++ .../tools/javalibpst/DescriptorIndexNode.java | 54 ++++++++------- .../fr/gouv/vitam/tools/javalibpst/LZFu.java | 57 ++++++++-------- .../tools/javalibpst/OffsetIndexItem.java | 54 ++++++++------- .../vitam/tools/javalibpst/PSTActivity.java | 54 ++++++++------- .../tools/javalibpst/PSTAppointment.java | 65 +++++++++--------- .../javalibpst/PSTAppointmentException.java | 55 ++++++++-------- .../javalibpst/PSTAppointmentRecurrence.java | 65 +++++++++--------- .../vitam/tools/javalibpst/PSTAttachment.java | 54 ++++++++------- .../tools/javalibpst/PSTByteFileContent.java | 37 +++++++++++ .../vitam/tools/javalibpst/PSTContact.java | 65 +++++++++--------- .../javalibpst/PSTConversationIndex.java | 37 +++++++++++ .../tools/javalibpst/PSTDescriptorItem.java | 65 +++++++++--------- .../vitam/tools/javalibpst/PSTDistList.java | 54 ++++++++------- .../vitam/tools/javalibpst/PSTException.java | 66 ++++++++++--------- .../gouv/vitam/tools/javalibpst/PSTFile.java | 65 +++++++++--------- .../tools/javalibpst/PSTFileContent.java | 37 +++++++++++ .../vitam/tools/javalibpst/PSTFolder.java | 54 ++++++++------- .../tools/javalibpst/PSTGlobalObjectId.java | 37 +++++++++++ .../vitam/tools/javalibpst/PSTMessage.java | 54 ++++++++------- .../tools/javalibpst/PSTMessageStore.java | 54 ++++++++------- .../tools/javalibpst/PSTNodeInputStream.java | 57 ++++++++-------- .../vitam/tools/javalibpst/PSTObject.java | 65 +++++++++--------- .../tools/javalibpst/PSTRAFileContent.java | 37 +++++++++++ .../vitam/tools/javalibpst/PSTRecipient.java | 54 ++++++++------- .../gouv/vitam/tools/javalibpst/PSTRss.java | 54 ++++++++------- .../gouv/vitam/tools/javalibpst/PSTTable.java | 54 ++++++++------- .../vitam/tools/javalibpst/PSTTable7C.java | 54 ++++++++------- .../tools/javalibpst/PSTTable7CItem.java | 66 ++++++++++--------- .../vitam/tools/javalibpst/PSTTableBC.java | 54 ++++++++------- .../tools/javalibpst/PSTTableBCItem.java | 66 ++++++++++--------- .../vitam/tools/javalibpst/PSTTableItem.java | 65 +++++++++--------- .../gouv/vitam/tools/javalibpst/PSTTask.java | 54 ++++++++------- .../vitam/tools/javalibpst/PSTTimeZone.java | 54 ++++++++------- .../tools/javalibpst/AppointmentTest.java | 37 +++++++++++ .../vitam/tools/javalibpst/DistListTest.java | 37 +++++++++++ .../tools/javalibpst/PSTFileContentTest.java | 37 +++++++++++ .../javalibpst/PSTGlobalObjectIdTest.java | 37 +++++++++++ .../vitam/tools/javalibpst/PasswordTest.java | 37 +++++++++++ .../vitam/tools/javalibpst/Version36Test.java | 37 +++++++++++ .../tools/mailextract/MailExtractApp.java | 59 ++++++++++------- .../mailextract/MailExtractException.java | 60 ++++++++++------- .../mailextract/MailExtractGraphicApp.java | 59 ++++++++++------- .../tools/mailextract/MailExtractLogger.java | 60 ++++++++++------- .../mailextract/MailExtractMainWindow.java | 59 ++++++++++------- .../tools/mailextract/MailExtractThread.java | 59 ++++++++++------- .../vitam/tools/mailextract/package-info.java | 37 +++++++++++ .../core/EmbeddedStoreExtractor.java | 60 ++++++++++------- .../mailextractlib/core/StoreAppointment.java | 60 ++++++++++------- .../mailextractlib/core/StoreAttachment.java | 60 ++++++++++------- .../mailextractlib/core/StoreContact.java | 60 ++++++++++------- .../mailextractlib/core/StoreElement.java | 60 ++++++++++------- .../mailextractlib/core/StoreExtractor.java | 60 ++++++++++------- .../core/StoreExtractorOptions.java | 60 ++++++++++------- .../mailextractlib/core/StoreFolder.java | 60 ++++++++++------- .../mailextractlib/core/StoreMessage.java | 60 ++++++++++------- .../mailextractlib/core/package-info.java | 37 +++++++++++ .../formattools/HTMLTextExtractor.java | 60 ++++++++++------- .../formattools/TikaExtractor.java | 59 ++++++++++------- .../formattools/package-info.java | 37 +++++++++++ .../formattools/rtf/CharsetUtils.java | 66 ++++++++++--------- .../formattools/rtf/HTMLFromRTFExtractor.java | 60 ++++++++++------- .../formattools/rtf/RTFGroupState.java | 60 ++++++++++------- .../formattools/rtf/package-info.java | 37 +++++++++++ .../mailextractlib/nodes/ArchiveUnit.java | 60 ++++++++++------- .../mailextractlib/nodes/MetadataPerson.java | 60 ++++++++++------- .../mailextractlib/nodes/MetadataXML.java | 60 ++++++++++------- .../mailextractlib/nodes/MetadataXMLList.java | 60 ++++++++++------- .../mailextractlib/nodes/MetadataXMLNode.java | 60 ++++++++++------- .../nodes/MetadataXMLSplittedNode.java | 60 ++++++++++------- .../nodes/MetadataXMLString.java | 60 ++++++++++------- .../mailextractlib/nodes/package-info.java | 37 +++++++++++ .../store/javamail/JMEmbeddedStore.java | 60 ++++++++++------- .../store/javamail/JMMimeMessage.java | 60 ++++++++++------- .../store/javamail/JMStoreExtractor.java | 60 ++++++++++------- .../store/javamail/JMStoreFolder.java | 60 ++++++++++------- .../store/javamail/JMStoreMessage.java | 60 ++++++++++------- .../javamail/LFFixingQPDecoderStream.java | 59 ++++++++++------- .../charsets/OtherMimeCharsetProvider.java | 60 ++++++++++------- .../javamail/charsets/RedirectCharset.java | 60 ++++++++++------- .../javamail/charsets/jutf7/Base64Util.java | 52 +++++++++------ .../charsets/jutf7/ModifiedUTF7Charset.java | 52 +++++++++------ .../javamail/charsets/jutf7/UTF7Charset.java | 52 +++++++++------ .../charsets/jutf7/UTF7StyleCharset.java | 52 +++++++++------ .../jutf7/UTF7StyleCharsetDecoder.java | 52 +++++++++------ .../jutf7/UTF7StyleCharsetEncoder.java | 52 +++++++++------ .../store/javamail/eml/EmlFolder.java | 60 ++++++++++------- .../store/javamail/eml/EmlStore.java | 60 ++++++++++------- .../store/javamail/eml/package-info.java | 37 +++++++++++ .../store/javamail/handlers/HandlerUtil.java | 37 +++++++++++ .../handlers/SignatureContentHandler.java | 37 +++++++++++ .../javamail/handlers/multipart_signed.java | 37 +++++++++++ .../store/javamail/handlers/package-info.java | 37 +++++++++++ .../store/javamail/handlers/pgp.java | 37 +++++++++++ .../store/javamail/handlers/pkcs7_mime.java | 37 +++++++++++ .../javamail/handlers/pkcs7_signature.java | 37 +++++++++++ .../store/javamail/handlers/x_pkcs7_mime.java | 37 +++++++++++ .../javamail/handlers/x_pkcs7_signature.java | 37 +++++++++++ .../store/javamail/mbox/MboxFolder.java | 60 ++++++++++------- .../store/javamail/mbox/MboxReader.java | 60 ++++++++++------- .../store/javamail/mbox/MboxStore.java | 60 ++++++++++------- .../store/javamail/mbox/package-info.java | 37 +++++++++++ .../store/javamail/package-info.java | 37 +++++++++++ .../thunderbird/ThunderbirdFolder.java | 60 ++++++++++------- .../thunderbird/ThunderbirdStore.java | 60 ++++++++++------- .../javamail/thunderbird/package-info.java | 37 +++++++++++ .../microsoft/MicrosoftStoreElement.java | 37 +++++++++++ .../microsoft/MicrosoftStoreMessage.java | 60 ++++++++++------- .../MicrosoftStoreMessageAttachment.java | 60 ++++++++++------- .../microsoft/msg/MsgConversationIndex.java | 60 ++++++++++------- .../microsoft/msg/MsgStoreExtractor.java | 60 ++++++++++------- .../store/microsoft/msg/MsgStoreFolder.java | 60 ++++++++++------- .../store/microsoft/msg/MsgStoreMessage.java | 60 ++++++++++------- .../msg/MsgStoreMessageAttachment.java | 60 ++++++++++------- .../store/microsoft/msg/package-info.java | 37 +++++++++++ .../store/microsoft/package-info.java | 37 +++++++++++ .../microsoft/pst/PstStoreAppointment.java | 60 ++++++++++------- .../store/microsoft/pst/PstStoreContact.java | 60 ++++++++++------- .../microsoft/pst/PstStoreExtractor.java | 60 ++++++++++------- .../store/microsoft/pst/PstStoreFolder.java | 60 ++++++++++------- .../store/microsoft/pst/PstStoreMessage.java | 60 ++++++++++------- .../pst/PstStoreMessageAttachment.java | 60 ++++++++++------- .../PstEmbeddedStoreExtractor.java | 60 ++++++++++------- .../embeddedmsg/PstEmbeddedStoreFolder.java | 60 ++++++++++------- .../pst/embeddedmsg/package-info.java | 37 +++++++++++ .../store/microsoft/pst/package-info.java | 37 +++++++++++ .../tools/mailextractlib/utils/DateRange.java | 60 ++++++++++------- .../utils/HtmlAndXmlEscape.java | 60 ++++++++++------- .../utils/MailExtractLibException.java | 60 ++++++++++------- .../utils/MailExtractProgressLogger.java | 60 ++++++++++------- .../mailextractlib/utils/RFC822Headers.java | 60 ++++++++++------- .../mailextractlib/utils/RawDataSource.java | 60 ++++++++++------- .../mailextractlib/utils/package-info.java | 37 +++++++++++ .../vitam/tools/mailextractlib/AllTests.java | 37 +++++++++++ .../tools/mailextractlib/TestMetadata.java | 37 +++++++++++ .../mailextractlib/TestTextExtraction.java | 37 +++++++++++ .../tools/mailextractlib/TestUtilities.java | 37 +++++++++++ .../store/TestEmlStoreExtractor.java | 37 +++++++++++ .../store/TestMboxStoreExtractor.java | 37 +++++++++++ .../store/TestMsgStoreExtractor.java | 37 +++++++++++ .../store/TestPstStoreExtractor.java | 37 +++++++++++ .../gouv/vitam/tools/resip/app/ResipApp.java | 60 ++++++++++------- .../tools/resip/app/ResipGraphicApp.java | 60 ++++++++++------- .../vitam/tools/resip/app/package-info.java | 37 +++++++++++ .../vitam/tools/resip/data/DustbinItem.java | 48 ++++++++------ .../tools/resip/data/NullDeserializer.java | 60 ++++++++++------- .../vitam/tools/resip/data/StatisticData.java | 37 +++++++++++ .../fr/gouv/vitam/tools/resip/data/Work.java | 60 ++++++++++------- .../vitam/tools/resip/data/package-info.java | 37 +++++++++++ .../gouv/vitam/tools/resip/event/Event.java | 37 +++++++++++ .../vitam/tools/resip/event/EventBus.java | 37 +++++++++++ .../tools/resip/event/EventListener.java | 37 +++++++++++ .../resip/event/SedaVersionChangedEvent.java | 37 +++++++++++ .../vitam/tools/resip/frame/AboutDialog.java | 37 +++++++++++ .../tools/resip/frame/BigTextEditDialog.java | 60 ++++++++++------- .../vitam/tools/resip/frame/CleanDialog.java | 37 +++++++++++ .../resip/frame/CreationContextDialog.java | 50 ++++++++------ .../tools/resip/frame/DuplicatesWindow.java | 37 +++++++++++ .../resip/frame/ExportContextDialog.java | 50 ++++++++------ .../vitam/tools/resip/frame/ImagePanel.java | 37 +++++++++++ .../vitam/tools/resip/frame/InOutDialog.java | 60 ++++++++++------- .../resip/frame/MailImportContextDialog.java | 50 ++++++++------ .../vitam/tools/resip/frame/MainWindow.java | 60 ++++++++++------- .../resip/frame/ManifestFindToolBar.java | 37 +++++++++++ .../tools/resip/frame/ManifestWindow.java | 60 ++++++++++------- .../tools/resip/frame/NumericFilter.java | 37 +++++++++++ .../vitam/tools/resip/frame/SearchDialog.java | 37 +++++++++++ .../tools/resip/frame/StatisticWindow.java | 60 ++++++++++------- .../resip/frame/TechnicalSearchDialog.java | 37 +++++++++++ .../tools/resip/frame/TestDialogWindow.java | 37 +++++++++++ .../tools/resip/frame/UsedTmpDirDialog.java | 37 +++++++++++ .../resip/frame/UserInteractionDialog.java | 37 +++++++++++ .../tools/resip/frame/VerifyDateDialog.java | 37 +++++++++++ .../tools/resip/frame/XmlEditDialog.java | 60 ++++++++++------- .../vitam/tools/resip/frame/package-info.java | 37 +++++++++++ .../frame/preferences/PreferencesDialog.java | 60 ++++++++++------- .../SedaConversionErrorHandler.java | 37 +++++++++++ .../preferences/SedaConversionWaiter.java | 37 +++++++++++ .../preferences/SedaVersionSelector.java | 37 +++++++++++ .../vitam/tools/resip/inout/MailImporter.java | 37 +++++++++++ .../vitam/tools/resip/inout/package-info.java | 37 +++++++++++ .../resip/parameters/CSVImportContext.java | 37 +++++++++++ .../parameters/CSVMetadataImportContext.java | 37 +++++++++++ .../parameters/CSVTreeImportContext.java | 37 +++++++++++ .../resip/parameters/CompactContext.java | 37 +++++++++++ .../resip/parameters/CreationContext.java | 50 ++++++++------ .../resip/parameters/DIPImportContext.java | 37 +++++++++++ .../resip/parameters/DiskImportContext.java | 37 +++++++++++ .../tools/resip/parameters/ExportContext.java | 37 +++++++++++ .../resip/parameters/InterfaceParameters.java | 60 ++++++++++------- .../resip/parameters/MailImportContext.java | 37 +++++++++++ .../tools/resip/parameters/Preferences.java | 60 ++++++++++------- .../resip/parameters/SIPImportContext.java | 37 +++++++++++ .../resip/parameters/TreatmentParameters.java | 60 ++++++++++------- .../resip/parameters/ZipImportContext.java | 37 +++++++++++ .../tools/resip/parameters/package-info.java | 37 +++++++++++ .../sedaobjecteditor/AnyXMLTypeEditor.java | 60 ++++++++++------- .../ArchiveUnitProfileEditor.java | 60 ++++++++++------- .../sedaobjecteditor/BooleanTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/DateTimeTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/DateTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/DigestTypeEditor.java | 60 ++++++++++------- .../resip/sedaobjecteditor/DoubleFilter.java | 60 ++++++++++------- .../sedaobjecteditor/EnumTypeEditor.java | 60 ++++++++++------- .../resip/sedaobjecteditor/IntegerFilter.java | 60 ++++++++++------- .../sedaobjecteditor/IntegerTypeEditor.java | 60 ++++++++++------- .../LinearDimensionTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/RelationshipEditor.java | 60 ++++++++++------- .../resip/sedaobjecteditor/RuleEditor.java | 60 ++++++++++------- .../sedaobjecteditor/SEDAObjectEditor.java | 60 ++++++++++------- .../SEDAObjectEditorConstants.java | 60 ++++++++++------- .../SIPInternalIDTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/StringTypeEditor.java | 60 ++++++++++------- .../sedaobjecteditor/TextTypeEditor.java | 60 ++++++++++------- .../resip/sedaobjecteditor/WeightEditor.java | 60 ++++++++++------- .../ArchiveUnitEditorPanel.java | 60 ++++++++++------- .../DataObjectGroupEditorPanel.java | 60 ++++++++++------- .../StructuredArchiveUnitEditorPanel.java | 60 ++++++++++------- .../StructuredDataObjectGroupEditorPanel.java | 60 ++++++++++------- .../TreeDataObjectPackageEditorPanel.java | 60 ++++++++++------- .../XMLArchiveUnitEditorPanel.java | 60 ++++++++++------- .../XMLDataObjectGroupEditorPanel.java | 60 ++++++++++------- .../AutomaticGrowingTextArea.java | 60 ++++++++++------- .../structuredcomponents/ExtensionButton.java | 60 ++++++++++------- .../SEDAObjectEditorCompositePanel.java | 60 ++++++++++------- .../SEDAObjectEditorPanel.java | 60 ++++++++++------- .../SEDAObjectEditorSimplePanel.java | 60 ++++++++++------- .../structuredcomponents/ScrollablePanel.java | 37 +++++++++++ .../viewers/DataObjectListCellRenderer.java | 50 ++++++++------ .../DataObjectListTransferHandler.java | 37 +++++++++++ .../viewers/DataObjectListViewer.java | 60 ++++++++++------- .../DataObjectPackageTreeCellRenderer.java | 50 ++++++++------ .../viewers/DataObjectPackageTreeModel.java | 60 ++++++++++------- .../viewers/DataObjectPackageTreeNode.java | 60 ++++++++++------- ...ataObjectPackageTreeNodesTransferable.java | 37 +++++++++++ .../DataObjectPackageTreeTransferHandler.java | 37 +++++++++++ .../viewers/DataObjectPackageTreeViewer.java | 60 ++++++++++------- .../DefaultTableHeaderCellRenderer.java | 37 +++++++++++ .../viewers/DuplicatesTableModel.java | 37 +++++++++++ .../viewers/StatisticCellRenderer.java | 37 +++++++++++ .../viewers/StatisticTableModel.java | 37 +++++++++++ .../AbstractUnitaryDataObjectEditor.java | 60 ++++++++++------- .../composite/ArchiveUnitEditor.java | 60 ++++++++++------- .../composite/BinaryDataObjectEditor.java | 60 ++++++++++------- .../composite/ComplexListTypeEditor.java | 60 ++++++++++------- .../composite/CompositeEditor.java | 60 ++++++++++------- .../composite/DataObjectGroupEditor.java | 60 ++++++++++------- .../composite/PhysicalDataObjectEditor.java | 60 ++++++++++------- .../composite/RuleTypeEditor.java | 37 +++++++++++ .../vitam/tools/resip/threads/AddThread.java | 60 ++++++++++------- .../threads/ChangeSeda2VersionThread.java | 60 ++++++++++------- .../resip/threads/CheckEndDateThread.java | 37 +++++++++++ .../resip/threads/CheckProfileThread.java | 60 ++++++++++------- .../tools/resip/threads/CleanThread.java | 60 ++++++++++------- .../tools/resip/threads/CompactThread.java | 60 ++++++++++------- .../tools/resip/threads/DeCompactThread.java | 60 ++++++++++------- .../tools/resip/threads/DuplicatesThread.java | 60 ++++++++++------- .../tools/resip/threads/ExpandThread.java | 60 ++++++++++------- .../tools/resip/threads/ExportThread.java | 60 ++++++++++------- .../tools/resip/threads/ImportThread.java | 60 ++++++++++------- .../resip/threads/MailExtractThread.java | 60 ++++++++++------- .../tools/resip/threads/SearchThread.java | 60 ++++++++++------- .../resip/threads/SeeManifestThread.java | 60 ++++++++++------- .../tools/resip/threads/StatisticThread.java | 60 ++++++++++------- .../resip/threads/TechnicalSearchThread.java | 60 ++++++++++------- .../tools/resip/threads/package-info.java | 37 +++++++++++ .../tools/resip/utils/ResipException.java | 50 ++++++++------ .../vitam/tools/resip/utils/ResipLogger.java | 60 ++++++++++------- .../vitam/tools/resip/utils/package-info.java | 37 +++++++++++ .../gouv/vitam/tools/resip/TestUtilities.java | 37 +++++++++++ .../gouv/vitam/tools/resip/UseTestFiles.java | 37 +++++++++++ .../resip/parameters/ExportContextTest.java | 37 +++++++++++ .../tools/resip/parameters/WorkTest.java | 37 +++++++++++ .../AllMetadataEditorTest.java | 37 +++++++++++ .../DataObjectGroupEditorTest.java | 37 +++++++++++ .../StructuredArchiveUnitEditorPanelTest.java | 37 +++++++++++ ...ucturedDataObjectGroupEditorPanelTest.java | 37 +++++++++++ .../XMLArchiveUnitEditorPanelTest.java | 37 +++++++++++ .../gouv/vitam/tools/sedalibsamples/App.java | 37 +++++++++++ .../vitam/tools/sedalibsamples/Sample1.java | 37 +++++++++++ .../vitam/tools/sedalibsamples/Sample2.java | 37 +++++++++++ .../vitam/tools/sedalibsamples/Sample3.java | 37 +++++++++++ .../tools/sedalibsamples/Sample3plus.java | 37 +++++++++++ .../vitam/tools/sedalibsamples/Sample4.java | 37 +++++++++++ .../core/AbstractUnitaryDataObject.java | 60 ++++++++++------- .../core/ArchiveDeliveryRequestReply.java | 60 ++++++++++------- .../tools/sedalib/core/ArchiveTransfer.java | 60 ++++++++++------- .../vitam/tools/sedalib/core/ArchiveUnit.java | 60 ++++++++++------- .../sedalib/core/ArchiveUnitRefList.java | 60 ++++++++++------- .../tools/sedalib/core/BinaryDataObject.java | 60 ++++++++++------- .../vitam/tools/sedalib/core/DataObject.java | 60 ++++++++++------- .../tools/sedalib/core/DataObjectGroup.java | 60 ++++++++++------- .../tools/sedalib/core/DataObjectPackage.java | 60 ++++++++++------- .../core/DataObjectPackageElement.java | 60 ++++++++++------- .../core/DataObjectPackageIdElement.java | 60 ++++++++++------- .../tools/sedalib/core/DataObjectRefList.java | 60 ++++++++++------- .../tools/sedalib/core/GlobalMetadata.java | 60 ++++++++++------- .../sedalib/core/PhysicalDataObject.java | 60 ++++++++++------- .../json/DataObjectPackageDeserializer.java | 60 ++++++++++------- .../json/DataObjectPackageSerializer.java | 60 ++++++++++------- .../tools/sedalib/core/json/package-info.java | 37 +++++++++++ .../tools/sedalib/core/package-info.java | 37 +++++++++++ .../tools/sedalib/core/seda/SedaContext.java | 37 +++++++++++ .../tools/sedalib/core/seda/SedaVersion.java | 37 +++++++++++ .../core/seda/SedaVersionConverter.java | 37 +++++++++++ .../droid/ContainerDroidIdentifier.java | 60 ++++++++++------- .../tools/sedalib/droid/DroidIdentifier.java | 60 ++++++++++------- .../tools/sedalib/droid/package-info.java | 37 +++++++++++ .../vitam/tools/sedalib/inout/SIPBuilder.java | 60 ++++++++++------- .../ArchiveTransferToDiskExporter.java | 60 ++++++++++------- .../ArchiveTransferToSIPExporter.java | 60 ++++++++++------- ...ataObjectPackageToCSVMetadataExporter.java | 60 ++++++++++------- .../DataObjectPackageToDiskExporter.java | 60 ++++++++++------- .../sedalib/inout/exporter/package-info.java | 37 +++++++++++ .../inout/importer/CSVMetadataFormatter.java | 37 +++++++++++ ...SVMetadataToDataObjectPackageImporter.java | 60 ++++++++++------- .../CSVTreeToDataObjectPackageImporter.java | 60 ++++++++++------- ...mpressedFileToArchiveTransferImporter.java | 60 ++++++++++------- ...ToArchiveDeliveryRequestReplyImporter.java | 60 ++++++++++------- .../DiskToArchiveTransferImporter.java | 60 ++++++++++------- .../DiskToDataObjectPackageImporter.java | 60 ++++++++++------- .../SIPToArchiveTransferImporter.java | 60 ++++++++++------- .../inout/importer/WindowsShortcut.java | 37 +++++++++++ .../sedalib/inout/importer/package-info.java | 37 +++++++++++ .../tools/sedalib/inout/package-info.java | 37 +++++++++++ .../sedalib/metadata/ArchiveUnitProfile.java | 60 ++++++++++------- .../sedalib/metadata/ManagementMetadata.java | 60 ++++++++++------- .../tools/sedalib/metadata/Operation.java | 60 ++++++++++------- .../tools/sedalib/metadata/SEDAMetadata.java | 60 ++++++++++------- .../sedalib/metadata/compacted/Document.java | 60 ++++++++++------- .../metadata/compacted/DocumentContainer.java | 60 ++++++++++------- .../metadata/compacted/DocumentPack.java | 60 ++++++++++------- .../metadata/compacted/FileObject.java | 60 ++++++++++------- .../sedalib/metadata/compacted/RecordGrp.java | 60 ++++++++++------- .../metadata/compacted/SubDocument.java | 60 ++++++++++------- .../metadata/content/AdditionalProof.java | 60 ++++++++++------- .../sedalib/metadata/content/Content.java | 60 ++++++++++------- .../sedalib/metadata/content/Coverage.java | 60 ++++++++++------- .../metadata/content/CustodialHistory.java | 60 ++++++++++------- .../metadata/content/DataObjectReference.java | 60 ++++++++++------- .../tools/sedalib/metadata/content/Event.java | 60 ++++++++++------- .../tools/sedalib/metadata/content/Gps.java | 60 ++++++++++------- .../sedalib/metadata/content/Keyword.java | 60 ++++++++++------- .../content/PersistentIdentifier.java | 60 ++++++++++------- .../metadata/content/ReferencedObject.java | 60 ++++++++++------- .../content/RelatedObjectReference.java | 60 ++++++++++------- .../tools/sedalib/metadata/content/Rule.java | 60 ++++++++++------- .../sedalib/metadata/content/Signature.java | 60 ++++++++++------- .../content/SignatureDescription.java | 60 ++++++++++------- .../sedalib/metadata/content/Signer.java | 60 ++++++++++------- .../metadata/content/SigningInformation.java | 60 ++++++++++------- .../content/TimestampingInformation.java | 60 ++++++++++------- .../sedalib/metadata/content/Validator.java | 60 ++++++++++------- .../metadata/content/package-info.java | 37 +++++++++++ .../tools/sedalib/metadata/data/FileInfo.java | 60 ++++++++++------- .../metadata/data/FormatIdentification.java | 60 ++++++++++------- .../tools/sedalib/metadata/data/Metadata.java | 60 ++++++++++------- .../metadata/data/PhysicalDimensions.java | 60 ++++++++++------- .../sedalib/metadata/data/Relationship.java | 60 ++++++++++------- .../tools/sedalib/metadata/data/Weight.java | 60 ++++++++++------- .../sedalib/metadata/data/package-info.java | 37 +++++++++++ .../metadata/management/AccessRule.java | 61 +++++++++-------- .../metadata/management/AppraisalRule.java | 61 +++++++++-------- .../management/ArchiveUnitIdentifierKey.java | 60 ++++++++++------- .../management/ClassificationRule.java | 60 ++++++++++------- .../management/DisseminationRule.java | 61 +++++++++-------- .../sedalib/metadata/management/HoldRule.java | 37 +++++++++++ .../sedalib/metadata/management/LogBook.java | 60 ++++++++++------- .../metadata/management/Management.java | 60 ++++++++++------- .../metadata/management/ReuseRule.java | 61 +++++++++-------- .../metadata/management/StorageRule.java | 60 ++++++++++------- .../metadata/management/UpdateOperation.java | 60 ++++++++++------- .../metadata/management/package-info.java | 37 +++++++++++ .../metadata/namedtype/AgencyType.java | 60 ++++++++++------- .../sedalib/metadata/namedtype/AgentType.java | 60 ++++++++++------- .../metadata/namedtype/AnyXMLListType.java | 60 ++++++++++------- .../metadata/namedtype/AnyXMLType.java | 60 ++++++++++------- .../metadata/namedtype/BooleanType.java | 60 ++++++++++------- .../namedtype/ComplexListInterface.java | 60 ++++++++++------- .../namedtype/ComplexListMetadataKind.java | 37 +++++++++++ .../namedtype/ComplexListMetadataMap.java | 37 +++++++++++ .../metadata/namedtype/ComplexListType.java | 60 ++++++++++------- .../DataObjectOrArchiveUnitReferenceType.java | 37 +++++++++++ .../metadata/namedtype/DateTimeType.java | 60 ++++++++++------- .../sedalib/metadata/namedtype/DateType.java | 60 ++++++++++------- .../metadata/namedtype/DigestType.java | 60 ++++++++++------- .../sedalib/metadata/namedtype/EnumType.java | 60 ++++++++++------- .../metadata/namedtype/EnumTypeConstants.java | 37 +++++++++++ .../namedtype/InnerIdentifierType.java | 60 ++++++++++------- .../metadata/namedtype/IntegerType.java | 60 ++++++++++------- .../namedtype/LinearDimensionType.java | 60 ++++++++++------- .../namedtype/LinkingAgentIdentifier.java | 37 +++++++++++ .../metadata/namedtype/NamedTypeMetadata.java | 60 ++++++++++------- .../sedalib/metadata/namedtype/PlaceType.java | 60 ++++++++++------- .../metadata/namedtype/RuleMetadataKind.java | 37 +++++++++++ .../sedalib/metadata/namedtype/RuleType.java | 60 ++++++++++------- .../metadata/namedtype/SIPInternalIDType.java | 60 ++++++++++------- .../metadata/namedtype/StringType.java | 60 ++++++++++------- .../sedalib/metadata/namedtype/TextType.java | 60 ++++++++++------- .../metadata/namedtype/package-info.java | 37 +++++++++++ .../tools/sedalib/metadata/package-info.java | 37 +++++++++++ .../tools/sedalib/process/Compactor.java | 60 ++++++++++------- .../tools/sedalib/process/DeCompactor.java | 60 ++++++++++------- .../tools/sedalib/process/package-info.java | 37 +++++++++++ .../tools/sedalib/utils/CompressUtility.java | 37 +++++++++++ .../sedalib/utils/LocalDateTimeUtil.java | 49 ++++++++------ .../tools/sedalib/utils/SEDALibException.java | 60 ++++++++++------- .../utils/SEDALibJsonProcessingException.java | 37 +++++++++++ .../sedalib/utils/SEDALibProgressLogger.java | 60 ++++++++++------- .../utils/digest/DigestProgressLogger.java | 60 ++++++++++------- .../sedalib/utils/digest/DigestSha512.java | 60 ++++++++++------- .../utils/digest/NioDigestComputer.java | 60 ++++++++++------- .../tools/sedalib/utils/package-info.java | 37 +++++++++++ .../tools/sedalib/xml/HtmlAndXmlEscape.java | 60 ++++++++++------- .../tools/sedalib/xml/IndentXMLTool.java | 62 +++++++++-------- .../tools/sedalib/xml/SEDAXMLEventReader.java | 60 ++++++++++------- .../sedalib/xml/SEDAXMLStreamWriter.java | 60 ++++++++++------- .../tools/sedalib/xml/SEDAXMLValidator.java | 37 +++++++++++ .../vitam/tools/sedalib/xml/package-info.java | 37 +++++++++++ .../tools/sedalib/SedaContextExtension.java | 37 +++++++++++ .../vitam/tools/sedalib/TestUtilities.java | 37 +++++++++++ .../vitam/tools/sedalib/UseTestFiles.java | 37 +++++++++++ .../sedalib/core/BinaryDataObjectTest.java | 37 +++++++++++ .../sedalib/core/DataObjectPackageTest.java | 37 +++++++++++ .../sedalib/core/GlobalMetadataTest.java | 37 +++++++++++ .../sedalib/core/PhysicalDataObjectTest.java | 37 +++++++++++ .../tools/sedalib/core/SEDA2VersionTest.java | 37 +++++++++++ .../ArchiveTransferSerDeserializerTest.java | 37 +++++++++++ .../core/seda/SedaVersionConverterTest.java | 37 +++++++++++ .../sedalib/core/seda/SedaVersionTest.java | 37 +++++++++++ ...rchiveDeliveryRequestReplyFromXmlTest.java | 37 +++++++++++ .../inout/ArchiveTransferToFromXmlTest.java | 37 +++++++++++ .../inout/CSVMetadataExporterTest.java | 37 +++++++++++ ...tadataToDataObjectPackageImporterTest.java | 37 +++++++++++ ...SVTreeToDataObjectPackageImporterTest.java | 37 +++++++++++ .../inout/CompressedFileImportTest.java | 37 +++++++++++ .../sedalib/inout/DiskImportExportTest.java | 37 +++++++++++ .../sedalib/inout/SEDAValidationTest.java | 37 +++++++++++ .../tools/sedalib/inout/SIPBuilderTest.java | 37 +++++++++++ .../tools/sedalib/inout/SIPImportTest.java | 37 +++++++++++ .../importer/CSVMetadataFormatterTest.java | 37 +++++++++++ .../metadata/ArchiveUnitProfileTest.java | 37 +++++++++++ .../tools/sedalib/metadata/ContentTest.java | 37 +++++++++++ .../tools/sedalib/metadata/DataTest.java | 37 +++++++++++ .../metadata/ManagementMetadataTest.java | 37 +++++++++++ .../sedalib/metadata/ManagementTest.java | 37 +++++++++++ .../metadata/namedtype/DateTimeTypeTest.java | 37 +++++++++++ .../tools/sedalib/process/CompactorTest.java | 37 +++++++++++ .../sedalib/process/DeCompactorTest.java | 37 +++++++++++ .../vitam/tools/sedalib/utils/ArchTests.java | 50 ++++++++------ .../sedalib/utils/LocalDateTimeUtilTest.java | 37 +++++++++++ .../tools/sedalib/utils/ResourceUtils.java | 37 +++++++++++ .../utils/digest/DigestSha512Test.java | 37 +++++++++++ .../tools/sedalib/xml/SEDAValidationTest.java | 37 +++++++++++ .../testsipgenerator/TestSipGeneratorApp.java | 60 ++++++++++------- 456 files changed, 16134 insertions(+), 7100 deletions(-) diff --git a/javalibpst/src/main/java/example/Test.java b/javalibpst/src/main/java/example/Test.java index 9dbdd70b..94e415ed 100644 --- a/javalibpst/src/main/java/example/Test.java +++ b/javalibpst/src/main/java/example/Test.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package example; import java.util.Vector; diff --git a/javalibpst/src/main/java/example/TestGui.java b/javalibpst/src/main/java/example/TestGui.java index 9fd8961a..baa02700 100644 --- a/javalibpst/src/main/java/example/TestGui.java +++ b/javalibpst/src/main/java/example/TestGui.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * */ diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java index 5612b762..b39b0fc3 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java index ea6bba23..416d7340 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java @@ -1,37 +1,40 @@ -/* - * Copyright 2010 Richard Johnson & Orin Eman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * --- + * contact@programmevitam.fr * - * This file is part of javalibpst. + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * javalibpst 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 3 of the License, or - * (at your option) any later version. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * javalibpst is distributed in the hope that 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. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * You should have received a copy of the GNU Lesser General Public License - * along with javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.javalibpst; import java.io.UnsupportedEncodingException; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java index e48ebac6..b73bcd93 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java index 066ee29e..013b64c9 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java index c515310a..1ef3240d 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java index 50ce3494..c0db8ea4 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java @@ -1,37 +1,40 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.javalibpst; import java.io.UnsupportedEncodingException; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java index 988f4c61..c5b3f0d6 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java index 3ea59303..7dd4172e 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java index 8ac104e6..17c018fa 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.IOException; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java index 21aae973..7cd1b0be 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java index 78b941c0..05ca6d3e 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.util.ArrayList; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java index 14ef3115..b902ac34 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java index b96da5d6..988ef25a 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java index 17b5113b..75e13d85 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * --- - * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . - * + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java index ddb16b0b..b014b4a2 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java index af97dcb5..3a7dd55d 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.IOException; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java index fd9de7b2..a65403d2 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java index d2cef0b6..2567a049 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.nio.ByteBuffer; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java index b2a5aaf1..489cfc59 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java index 19033f07..4ab4ad6a 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java index 77fc8708..5ff1980c 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java @@ -1,37 +1,40 @@ -/* - * Copyright 2010 Richard Johnson & Orin Eman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * --- + * contact@programmevitam.fr * - * This file is part of javalibpst. + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * javalibpst 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 3 of the License, or - * (at your option) any later version. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * javalibpst is distributed in the hope that 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. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * You should have received a copy of the GNU Lesser General Public License - * along with javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.javalibpst; import java.io.ByteArrayOutputStream; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java index 845a4baf..1558f2f3 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java index 80fad9f9..6186d417 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.File; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java index 184ecc00..4cfae28c 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java index 5a46e3e0..de720db2 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java index 7520a7d2..f181b099 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java index 0237e933..b6b872d0 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java index 8f1f464d..ce5988b1 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * --- - * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . - * + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java index f9e0e6cd..776d5069 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java index 5866a916..da533847 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * --- - * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . - * + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java index b8046318..7bb6c869 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java @@ -1,34 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- * --- - *

- * This file is part of javalibpst. - *

- * javalibpst 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 3 of the License, or - * (at your option) any later version. - *

- * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java index 9a56c1ca..f77d85fa 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java index 24da5c95..e5ae7d16 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java @@ -1,35 +1,39 @@ /** - * Copyright 2010 Richard Johnson & Orin Eman + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * contact@programmevitam.fr * - * http://www.apache.org/licenses/LICENSE-2.0 + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * 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. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * --- + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * This file is part of javalibpst. - * - * javalibpst 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 3 of the License, or - * (at your option) any later version. - * - * javalibpst is distributed in the hope that 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 javalibpst. If not, see . + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java index c396b778..161c60dc 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import org.junit.Assert; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java index 1b257d24..e075f635 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.File; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java index de5171e6..2fa3da1f 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java index 5ea402ec..a8945b30 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.util.Date; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java index da03e856..9e6bf584 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.File; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java index 0b841763..be755cdc 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.javalibpst; import java.io.File; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java index b96f06a0..478a7148 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java index ad23975c..4ad85cac 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java index 4fa84b67..934ea278 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java index 51897100..796b5369 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java index de0fb52b..ae86765d 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java index 214ca794..020d73ae 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextract; diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java index b94167d0..fd790ee8 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides the class for the simple command and graphic application. */ diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java index aa509040..7843ce69 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java index bc38f695..9cb924ab 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java index f4bfcf23..2498677e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.formattools.TikaExtractor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java index f17e4c0f..bd2c66b1 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java index 2d3486c0..fc734514 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java index 35099309..d46d4fce 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java index daafd8a4..f502bad5 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java index 912dc66f..0d362e28 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java index 24780516..1e63ce41 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.core; import fr.gouv.vitam.tools.mailextractlib.formattools.HTMLTextExtractor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java index 4590c91d..ef6f1882 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all core classes and method to do extraction and listing of mail * boxes. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java index 865c7531..dd5fde4d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.formattools; import org.jsoup.Jsoup; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java index 5cd88a1c..65917acd 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.formattools; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java index bd6ba8da..15b02b6f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes and methods to deal with identification and format * conversion tools. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java index 12851b74..9d17b816 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java @@ -1,36 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. - *

- * This is copied from Tika 1.17 - * under http://www.apache.org/licenses/LICENSE-2.0 - *

- * Conform with MSDN directives to de-encapsulate HTML from RTF - * https://msdn.microsoft.com/en-us/library/ee159984(v=exchg.80).aspx + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - /** * This is copied from Tika 1.17 * under http://www.apache.org/licenses/LICENSE-2.0 diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java index 6194f155..a265ff0b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java @@ -1,31 +1,41 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.formattools.rtf; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java index 36bd41d1..2493a51c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java @@ -1,31 +1,41 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.formattools.rtf; import java.nio.charset.Charset; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java index 90d92505..a358723e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes and methods to de-encapsulate HTML and text from RTF. *

diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java index 47108a72..e1b1eb9c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java index 2a8091d2..f7e40b09 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; import jakarta.mail.internet.MimeUtility; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java index 567f8b63..dcad546b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java index a9816503..b44bcc1b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; import java.util.ArrayList; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java index ffde282e..711f112c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java index 0e9a8efc..0d9fe4c1 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java index 75ce21f4..0d38fb61 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.nodes; import fr.gouv.vitam.tools.mailextractlib.utils.HtmlAndXmlEscape; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java index 9dd50707..d260c343 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes and method to create, manage and edit to disk the * ArchiveUnits with their metadata. The metadata is in XML format on disk. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java index cb1f7e4a..51728ba9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java index 83d571de..b76515f6 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail; import jakarta.mail.Folder; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java index dad23acd..7c54c0d0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail; import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java index 3ac4a0ad..7dd5c355 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail; import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java index d891adbd..05a04703 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java index a0fcdef1..1138c5eb 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java @@ -1,28 +1,39 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java index 24b49a83..6bf0916a 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets; import fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7.ModifiedUTF7Charset; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java index 6d4dd70e..1d01d1e0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets; import java.nio.charset.Charset; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java index 9c7773c3..1cd2ede3 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java index 1eae7868..ce5fbf22 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java index e17b1d70..57b47595 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java index 44d321d0..e4cdba43 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java index cef524b1..067ddb7d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java index 2b403a6b..9c642d8a 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java @@ -1,25 +1,39 @@ -/* ==================================================================== - * Copyright (c) 2006 J.T. Beetstra +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ==================================================================== + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java index 72cc688c..934d1d29 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java index be96a951..03b2827e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMEmbeddedStore; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java index c9a40213..bafbb1a5 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a rfc822 single message container for * JavaMail library. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java index bf53b29b..bbe9eefc 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import java.io.BufferedInputStream; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java index 0793d380..7ba61d85 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import java.io.IOException; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java index 8a01ee87..80348bde 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import java.io.FilterOutputStream; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/package-info.java index 27fd6646..17d9ee49 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * S/MIME and OpenPGP handlers for the JavaMail API. */ diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java index 9b33dc31..ed69ac5b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import jakarta.activation.ActivationDataFlavor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java index 338d745f..06b18030 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import jakarta.activation.ActivationDataFlavor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java index 42d60ceb..85e495a7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import jakarta.activation.ActivationDataFlavor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java index a8c369e3..83a79784 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import jakarta.activation.ActivationDataFlavor; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java index 6ad79af0..c21cea4b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; import java.io.IOException; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java index a307255e..c63775d5 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java index a8b847c8..d916f8e8 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java index 1905b0e0..eef93461 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMEmbeddedStore; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java index f65d63e0..c8ad903c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a Thunderbird mbox provider for JavaMail * library. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java index 634a3eef..88849b40 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to extract stores with JavaMail library. *

diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java index 60aa2b18..6ad3881f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java index 19f25b78..207e854d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird; import jakarta.mail.*; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java index 8df50a77..0d7d93d9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a Thunderbird mbox directory/file provider for JavaMail * library. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java index acea1a46..1c172be3 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store.microsoft; import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java index f378b510..7acc26c9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java index 11e0c3f1..f63d9aba 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft; import java.util.Date; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java index ee76ee86..3c56bfc6 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; import java.util.ArrayList; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java index d46f8df6..b93cd4ba 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java index a9f1e1d3..8e292e47 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java index caddc0e2..a88bd1ed 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java index 3b63bee8..447e674b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; import fr.gouv.vitam.tools.mailextractlib.store.microsoft.MicrosoftStoreMessageAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java index f9ed88f0..e0919e42 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a Microsoft .msg single message container * through POI HSMF library. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java index 2afecabe..289f853b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to extract stores in Microsoft format. *

diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java index d349ad52..eaa89715 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.*; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java index 18525f9e..5bbf8cff 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.PSTAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java index 90073d20..150ab4c0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.PSTException; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java index 042433c6..add359ee 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.*; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java index edcf6028..ff169a9c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.PSTAppointment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessageAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessageAttachment.java index 7ceee60d..60fff47b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessageAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessageAttachment.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; import fr.gouv.vitam.tools.javalibpst.PSTAttachment; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java index d96bd5d5..2a6e20b0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.embeddedmsg; import fr.gouv.vitam.tools.javalibpst.PSTMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java index 3c0a4d27..aefba9e5 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.embeddedmsg; import fr.gouv.vitam.tools.javalibpst.PSTMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java index 99d4aa59..015a2163 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a Microsoft .pst embedded message extraction with libpst library. */ diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java index 2e209ce1..bbf7fe12 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Provides all classes to implement a Microsoft .pst messages container with * libpst library. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java index 6256e373..0bbfb873 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.utils; import java.text.SimpleDateFormat; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java index 2b40bee6..b9bf78cc 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.utils; import java.util.Map; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java index f501b97d..4c3a2993 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.utils; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java index f76b3050..50641ec4 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.mailextractlib.utils; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java index 0b16c63f..a0afaf48 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.utils; import fr.gouv.vitam.tools.mailextractlib.core.StoreMessage; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java index 935b23a4..75996e91 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.mailextractlib.utils; import jakarta.activation.DataSource; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java index f1cda5b5..c4da3b00 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Utility classes. */ diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java index 0dcced30..9e005c0e 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib; import ch.qos.logback.classic.LoggerContext; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java index e15e8ccd..a6a11696 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib; import fr.gouv.vitam.tools.mailextractlib.AllTests; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java index aa7cde89..21a410ae 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib; import fr.gouv.vitam.tools.mailextractlib.core.StoreAppointment; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java index 5e1a831a..daa9154d 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib; import fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.OtherMimeCharsetProvider; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java index 4d40a1e7..14c3eb63 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store; import fr.gouv.vitam.tools.mailextractlib.AllTests; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java index ba952a7c..086367b0 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store; import fr.gouv.vitam.tools.mailextractlib.AllTests; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java index d2cdfe31..931f6f22 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store; import fr.gouv.vitam.tools.mailextractlib.AllTests; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java index 2722290b..bd432278 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.mailextractlib.store; import fr.gouv.vitam.tools.mailextractlib.AllTests; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java index abd59d93..525d14fd 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.app; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java index 02e83d0c..e3284884 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.app; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java index 78c07d02..9133f2b2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.app; \ No newline at end of file diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java index 3a27a2a0..18d16b8e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr + * contact@programmevitam.fr * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.data; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java index 4373fee0..9550988c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.data; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java index a38da19c..e77a3970 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.data; import java.util.List; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java index 7f01dfbd..0b63f820 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.data; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java index 94b6fb6d..5799373b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.data; \ No newline at end of file diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java index 4324c115..538a23b2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.event; public interface Event { diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java index 63fde28b..3ce16037 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.event; import java.util.*; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventListener.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventListener.java index d7d68205..ba357b94 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventListener.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventListener.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.event; @FunctionalInterface diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java index d5686235..ebcb6afb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.event; import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java index 2342e851..610449ab 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java index 66901811..d3e31222 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java index b1909752..4493e201 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CreationContextDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CreationContextDialog.java index d8065ba0..da24f202 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CreationContextDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CreationContextDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java index e3b4a655..9cda8e7a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java index d15681b7..0d0e3397 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java index 5bc9bc29..6818b008 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import javax.swing.*; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java index 16b877b8..a5ec3594 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java index 0c605980..cf7a7e36 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java index cfa84b12..c8465b35 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java index 13c3f6cb..87098700 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import org.fife.rsta.ui.search.FindToolBar; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java index eee57c9d..5cc6dece 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java index e879fe8a..0b918b25 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import javax.swing.text.AttributeSet; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java index 6b8356f8..7b4d427b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java index 749510e7..4c021f7e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java index af523791..5028153a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TestDialogWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TestDialogWindow.java index 8e8ad7b4..70c4d078 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TestDialogWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TestDialogWindow.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java index 3c62d931..65e64fbd 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import javax.swing.*; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java index 236a52a5..8993fcfb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java index 054f593d..f884c58b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java index dc104724..ea0c8445 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java index 861195de..845e880a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame; \ No newline at end of file diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java index 1e8b54d1..2cc9e5d5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.frame.preferences; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java index 8f416f8e..de97fed5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame.preferences; import fr.gouv.vitam.tools.resip.frame.UserInteractionDialog; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionWaiter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionWaiter.java index 3388005d..5bb82f31 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionWaiter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionWaiter.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame.preferences; import javax.swing.SwingWorker; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java index 624a42f9..207d1859 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.frame.preferences; import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java index 05bca388..aa92df10 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java index 2a548d5b..8bc36209 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.inout; \ No newline at end of file diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java index b423c266..d39bfaa5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java index 933ba25d..39c2bdc7 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java index 76dbf24b..291e29d0 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java index 8d28190b..90efe723 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java index 561eff24..2d91e452 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.parameters; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java index 4b89b032..4a5dda6a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java index e03c9e4f..660f25bc 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java index 385c44ef..694188db 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java index ea0782cc..f848cc07 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.parameters; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java index 642401fa..cffcaa5f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java index 7ed574d8..6f8d4774 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.parameters; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java index 1aa8ddee..2b2e4fe4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java index 8e719bc1..baeea5a6 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.parameters; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java index e1872f44..eb026d15 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java index 1a8bb040..8181de7b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java @@ -1,2 +1,39 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.parameters; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java index b9f9966d..ad194c7f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java index b3e2dc4e..b8e3b116 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java index 9a5b938e..65f863b5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java index 8d0d3b39..565bb220 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java index d3e7e69b..69ce6283 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java index dd6deb79..e924020b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java index b607581d..62950ea9 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java index a3c9beb1..b4a060a5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java index fa198fc5..ac9a6610 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java index f5324d43..1fe6452b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java index 43fac825..8cd759e8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java index 21e1c3a1..e8c44469 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java index 7894d89d..df686599 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java index 5a08b9c2..9681e442 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java index 7eaffebf..694dd50a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java index 36a00ada..f1e91383 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java index 0b6e0ccc..1b1eb98f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java index d75985ac..e19d009c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java index 3d0d2306..6ce9972c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/ArchiveUnitEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/ArchiveUnitEditorPanel.java index 2d5c7b7f..62c1653b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/ArchiveUnitEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/ArchiveUnitEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/DataObjectGroupEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/DataObjectGroupEditorPanel.java index 247ec4b5..f7bc3715 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/DataObjectGroupEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/DataObjectGroupEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java index 3f1c9047..66d1c9fc 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java index 5ae0bf60..e1461fcf 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java index 95449e4e..07c16f81 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java index 4ba6d820..b499353b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java index 1aa6ce74..18967111 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java index 2468db21..b0c8815a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java index c7de38b7..a4c58062 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java index 02408bfb..9bf5287b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java index 8555ddb8..12115691 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java index d3bc6e7e..956ed5de 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java index 7cc7c444..081d6ca8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents; import javax.swing.*; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java index 1576989e..3e984edd 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java index 0045f269..62f11f2a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java index 8e98cf37..dc61ad81 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java index df872d49..ee010fbe 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java index 233183f3..f7be0822 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java index f6f8c2a6..9a869a54 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java index f9d628c7..19c45d11 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java index 64823f51..9b1aff45 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java index 69c2391d..c4d8181d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java index 1199aab5..c3886e49 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; /** diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java index fab48219..3d61aef0 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; import fr.gouv.vitam.tools.sedalib.core.ArchiveUnit; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java index 059e76ba..95e59c45 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; import javax.swing.*; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java index 9def808b..3ce1f6b5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; import fr.gouv.vitam.tools.resip.data.StatisticData; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java index f5856be2..26d71f56 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java index 55e69a39..df434d66 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java index eea8f84b..c132bc4d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java index 42404578..39cb6aed 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java index c497d6cd..946d896d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java index 4e56cf89..d47fd1db 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java index b4a64bfa..e54a558b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java index cacf01a4..6d208c62 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.composite; import fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditor; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java index 4d8ba93f..ba7ded6a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java index 09404c19..38f00304 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java index 06f5128b..2baaf50e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.threads; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java index df52277d..defedbd2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java index 6a888579..3a9e9a83 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java index 8fed7de1..828aeaf4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java index 68b383c8..bbf28b00 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java index f04600ba..d2a61da6 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java index e9fce42f..87e4c604 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java index 0c903187..803b40a7 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java index e1e5217b..b1073da4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java index 30861f37..198a6e60 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java index edf57a3e..f763d062 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java index 0ba29fdd..92290301 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java index 1a4a0e92..6f7c95ca 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java index 44fd24cf..7167a1d8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java index d71a281a..f2dfb9c4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.threads; \ No newline at end of file diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java index 0df8db79..7ecbab4b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@programmevitam.fr - * - * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. + * contact@programmevitam.fr * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.utils; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java index beb96800..113c4811 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.utils; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java index f07304a7..7191c2b6 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java @@ -1 +1,38 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.utils; \ No newline at end of file diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java index 179733e7..84d19587 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip; import fr.gouv.vitam.tools.resip.utils.ResipException; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java index 7c15b5ea..2d9d1331 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip; import fr.gouv.vitam.tools.resip.utils.ResipException; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java index 94e73fd5..d3115d14 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.parameters; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java index 3e236b9d..4b5e694f 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.parameters; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java index c92e2c53..2e3b41e0 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.ScrollablePanel; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java index caa94d88..84ce4595 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.ScrollablePanel; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java index 9a4decaf..a19d5d45 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents.StructuredArchiveUnitEditorPanel; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java index 36316459..7a2bb2d8 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java index 8f7182a5..679d0cb7 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java index 4bc3f90e..3cce8747 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; /** diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java index 34e76bf7..ad6475c0 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; import fr.gouv.vitam.tools.sedalib.inout.SIPBuilder; diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java index 7a4f85f3..2facb55c 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; import fr.gouv.vitam.tools.sedalib.inout.SIPBuilder; diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java index e390c3a6..c76c659e 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; import fr.gouv.vitam.tools.sedalib.inout.SIPBuilder; diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java index 83511e8d..6d2a97c7 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; import fr.gouv.vitam.tools.sedalib.inout.SIPBuilder; diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java index aa5fa825..605a996a 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalibsamples; import fr.gouv.vitam.tools.sedalib.core.ArchiveUnit; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java index b812507d..484c2776 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java index e19eaa6e..49265435 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java index 1cd42839..0baf49a9 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java index 29f2852a..6c77166f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java index 3579955d..22ab3452 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java index d403af0d..e2006b4e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java index 33a68c38..15faa757 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java index a81bf6ea..520e2ea7 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java index 122eb25e..7442b293 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageElement.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageElement.java index ee767cf3..116a5d76 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageElement.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageElement.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java index 50ad2fa6..e84c7ab3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java index 1626dc0e..5750b295 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java index 98bf85cb..62700c54 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java index 493c96cc..e3bc10d3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java index 290494cf..a883c74d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core.json; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java index 60714718..4b339fc1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.core.json; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java index f98e424e..15dc0d58 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for Jackson json de/serializer of special objects */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java index 0ac731df..7a7d7309 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA structures management and serialization, deserilization to * json and to XML diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java index e80aceeb..64156cd6 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.seda; public class SedaContext { diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersion.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersion.java index 1d93213a..5d2f3aed 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersion.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersion.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.seda; public enum SedaVersion { diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java index b728bab6..37b2372d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.seda; import fr.gouv.vitam.tools.sedalib.core.BinaryDataObject; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java index aab208ed..a0146e5a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.droid; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java index 59156e24..cd1ffa2f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.droid; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java index 3494d7e5..0e3eab77 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for Digital Record Object IDentification(DROID) usage classes. This * tool and the PRONOM file format register are maintained by The National diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java index 6e5eeca3..2c8810df 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java index ae6797e5..a7e53ae8 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.exporter; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java index bfd68f89..3f3f8baa 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.exporter; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java index fb5ab984..581ec31d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.exporter; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java index b6afa912..f6631644 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.exporter; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java index c7a586a0..1c298d5e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for tools exporting archive structure and metadata to disk hierarchy, and to SEDA packets SIP */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java index 3a0a43c2..d700e4f3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout.importer; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java index 5474ac6a..1692bdec 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java index 94d2b552..420cc2e0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java index c8bab7c5..06fbd24a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java index 3344f7e2..c550e6cb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java index 01d800cb..65504e72 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java index 2f419155..02af6e9a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA dataObjectPackage the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java index ff5040e6..d6bc5926 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java index 31e13b54..8ca035a8 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Represents a Windows shortcut (typically visible to Java only as a '.lnk' file). *

diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java index 73d70e25..7a494c53 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for tools importing archive structure and metadata from disk hierarchy, and from SEDA packets SIP/DIP */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java index 32806556..0d5b048d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for building, importing and exporting archive structure and metadata tools * (for high-level usage, see the SIPBuilder class). diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfile.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfile.java index 7abe9c4c..b7cbb954 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfile.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfile.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java index 7ef14127..938cd5f3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java index 88fbe056..e206c2c0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/SEDAMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/SEDAMetadata.java index ed69f9ee..6eb0d651 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/SEDAMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/SEDAMetadata.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java index 4d75df14..68b058be 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java index 96eb65f0..a9636f09 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java index 66b6ca95..3c0ec9bb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java index 3538f251..d89e914c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java index 9a195c56..613740c2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java index 166d0e83..eed2ee2d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.compacted; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java index 5e033df0..a3368c92 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java index 58bf43d1..4ef09601 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java index 8a177723..061e3656 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java index 9ddaa648..1af57ce3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/DataObjectReference.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/DataObjectReference.java index d7223a7c..86b54921 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/DataObjectReference.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/DataObjectReference.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Event.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Event.java index 01e410e5..2cc015f7 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Event.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Event.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java index d2c4b029..a8a8fce1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Keyword.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Keyword.java index cf3ff65d..e348fc6c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Keyword.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Keyword.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java index abd1b712..781b84d2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java index ad34bd79..98ba9a77 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java index b18fff3d..1bfa9921 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java index 247a3b5a..5ee9df17 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signature.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signature.java index 95027aee..a1574910 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signature.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signature.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java index bcef4d43..89275acc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java index d5fde9d7..0ee85db2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java index 1b271837..f5254735 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java index 5af742b1..d077cc98 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Validator.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Validator.java index e8406065..f871284e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Validator.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Validator.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java index cf115309..8c876359 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA specific Content, with serialization to and * deserilization from XML diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java index d5f18b1f..644c8858 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java index 17b6ce78..b64c41da 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Metadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Metadata.java index ca022fee..76cff7ad 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Metadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Metadata.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/PhysicalDimensions.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/PhysicalDimensions.java index e85a8655..cf5ba5b0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/PhysicalDimensions.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/PhysicalDimensions.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java index e42e5cf8..075eabcc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java index e9b44658..acf283df 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java index 2d3ab86b..5cb34358 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA specific DataObject, with serialization to and * deserilization from XML diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java index 82dd62fa..0e424505 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java @@ -1,31 +1,40 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.metadata.management; import fr.gouv.vitam.tools.sedalib.metadata.content.Rule; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java index cdec11c4..cf7b1279 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java @@ -1,31 +1,40 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.metadata.management; import fr.gouv.vitam.tools.sedalib.metadata.content.Rule; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java index ef27a2b6..ec2df58d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java index 6ef31ef8..4e8ffa70 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java index d6f5c8a9..5223676f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java @@ -1,31 +1,40 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.metadata.management; import fr.gouv.vitam.tools.sedalib.metadata.content.Rule; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java index c0c328f1..03b9bb2a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.management; import fr.gouv.vitam.tools.sedalib.metadata.content.Rule; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java index 58573f37..5998e07a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/Management.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/Management.java index 507f8ff9..a70745b0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/Management.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/Management.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java index 8e3bd16d..625d430e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java @@ -1,31 +1,40 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.metadata.management; import fr.gouv.vitam.tools.sedalib.metadata.content.Rule; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java index 8e22b5f5..a5fd2f4e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java index 1a12ac54..ab9a3224 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java index 37caa5bc..d1a10087 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA specific Management, with serialization to and * deserilization from XML diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java index cc583c64..a6eb75a4 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java index 37db016e..d22610fc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java index d77d8091..1dbf3d33 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java index 489e3460..05903c5b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java @@ -1,29 +1,39 @@ /** - * RegisteredDate * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java index 3bd42da9..4819db7d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java index a3d3b50c..674388fb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java index 6740deb3..7fc19821 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; /** diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java index 3b6ba686..50b9444f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java index 248408bc..a86c9e43 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java index d6e0e543..5789d5aa 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; import fr.gouv.vitam.tools.sedalib.metadata.content.DataObjectReference; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java index a8364c4a..6dc179cb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java index 9bc23ff1..fd4758c5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java index e000ff7a..c2f7f8af 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java index 64f32fbc..31d42bc6 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java index 8ed8a456..e6bd06fb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; import java.util.Arrays; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java index 16eb8dd5..e927fa24 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java index 96004171..0732ed09 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java index a0f4a22e..605b6e79 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java index 61dc0292..5373e0c5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/NamedTypeMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/NamedTypeMetadata.java index d9547752..a0e10255 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/NamedTypeMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/NamedTypeMetadata.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java index a7e76524..1a6e3d07 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java index 60c981d7..db70a973 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; public class RuleMetadataKind extends ComplexListMetadataKind { diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java index e1922c60..8e81ae3c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java index 9ec070cd..7fb346a8 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java index f85450d9..a72a4ab2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java index 35f06227..709dfd21 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java index b1d74e3f..6c139f69 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA generic metadata types, which can have different XML names, with serialization to and * deserilization from XML diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java index f19fd698..9653cf6a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for SEDA structure objects (DataObjectPackage, ArchiveUnits and DataObjects) metadata with serialization to and * deserilization from XML.

diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java index 3cb5d0e8..ab2516a3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.process; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java index e211a701..70214b59 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.process; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java index b109db0d..f3d79484 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for building, importing and exporting archive structure and metadata tools * (for high-level usage, see the SIPBuilder class). diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java index 2cd19fe3..a5e34b96 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.utils; import fr.gouv.vitam.tools.sedalib.droid.DroidIdentifier; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java index fc964724..1648b64f 100755 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java @@ -1,28 +1,39 @@ -/* - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@culture.gouv.fr + * contact@programmevitam.fr * - * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * This software is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL-C license as - * circulated by CEA, CNRS and INRIA at the following URL "https://cecill.info". + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you - * accept its terms. + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java index 24880cac..499a5557 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibJsonProcessingException.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibJsonProcessingException.java index 2e6b965b..7b1ca564 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibJsonProcessingException.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibJsonProcessingException.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /* * */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java index fac3aa1d..1525daa0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveDeliveryRequestReply the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java index fc14188b..4c80e42e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils.digest; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java index 7631f23b..61c872f1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils.digest; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java index ab38c84c..c99e0d90 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.utils.digest; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java index 93d9e8a6..3af18d8e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for utility classes (exceptions, log...) */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java index 3dc2eb5e..79d0d9fd 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@culture.gouv.fr - *

- * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.xml; import java.util.Map; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java index c2346c98..d0e25bbd 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java @@ -1,30 +1,40 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. - **/ + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.xml; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java index 06abb9b0..2b84c51a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.xml; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java index 86c73990..1b90e805 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.sedalib.xml; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java index 29ccbc10..9ee237b1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.xml; import fr.gouv.vitam.tools.sedalib.core.seda.SedaContext; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java index 30dbbd33..c567bb90 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ /** * Package for XML manipulation tools (indent, read, write) using STAX */ diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java index fdc11be3..c67558c8 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib; import fr.gouv.vitam.tools.sedalib.core.seda.SedaContext; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java index 93372fcf..85abc982 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java index f1b40754..4566f71a 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java index 467ad1fb..07ac5b92 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java index a3a51845..414a1510 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java index eac20580..0f6a5bb4 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java index c6125a98..0f12c1d2 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java index 352a88c9..73316608 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java index 7c75a86a..be8b989b 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.json; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java index b21c6165..369b7679 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.seda; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java index 694964dd..216de89e 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.core.seda; import org.junit.jupiter.api.Test; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java index d6c19f60..4938b589 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java index fcf22be2..cea2a78d 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java index 1ae72307..65ca09ae 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java index b183c0e9..034bde76 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java index 335c432a..39855e45 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java index ba46f052..82e95e04 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java index 34c722d0..001e4cfc 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java index 177cf216..d5753e62 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java index 53a46010..6cc183a8 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java index 4f160eb1..f1a3f7d7 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout; import com.fasterxml.jackson.databind.MapperFeature; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java index 39f64e61..d46bed0d 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.inout.importer; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java index c9705b01..0afd5733 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java index 43eabc3c..d2aa651a 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java index 99c6a14c..90cea929 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java index 80ec4326..464e68fb 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java index 7b55be54..f3f25e62 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java index e051ba57..925d47d7 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.metadata.namedtype; import org.junit.jupiter.api.DisplayName; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java index 0b6c9e0a..2609ae4e 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.process; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java index 14e68a25..7134d911 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.process; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java index d243fdc3..3481da76 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java @@ -1,30 +1,40 @@ -/* - * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2015-2022) +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. * - * contact.vitam@culture.gouv.fr + * contact@programmevitam.fr * - * This software is a computer program whose purpose is to implement a digital archiving back-office system managing - * high volumetry securely and efficiently. + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. * - * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA at the following URL "https://cecill.info". + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". * - * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. * - * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. * - * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ - package fr.gouv.vitam.tools.sedalib.utils; import com.tngtech.archunit.base.DescribedPredicate; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java index 16c52781..91dc5c18 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.utils; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java index 968bbbcf..882fbfe2 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.utils; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512Test.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512Test.java index 1c9456bd..a29e1d6c 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512Test.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512Test.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.utils.digest; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java index f21eb635..734e47ed 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java @@ -1,3 +1,40 @@ +/** + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. + */ package fr.gouv.vitam.tools.sedalib.xml; import fr.gouv.vitam.tools.sedalib.SedaContextExtension; diff --git a/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java b/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java index 602566f2..8f592dc7 100644 --- a/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java +++ b/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java @@ -1,29 +1,39 @@ /** - * Copyright French Prime minister Office/DINSIC/Vitam Program (2015-2019) - *

- * contact.vitam@programmevitam.fr - *

- * This software is developed as a validation helper tool, for constructing Submission Information Packages (archives - * sets) in the Vitam program whose purpose is to implement a digital archiving back-office system managing high - * volumetry securely and efficiently. - *

- * This software is governed by the CeCILL 2.1 license under French law and abiding by the rules of distribution of free - * software. You can use, modify and/ or redistribute the software under the terms of the CeCILL 2.1 license as - * circulated by CEA, CNRS and INRIA archiveTransfer the following URL "http://www.cecill.info". - *

- * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - * users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the - * successive licensors have only limited liability. - *

- * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or - * developing or reproducing the software by the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it is reserved for developers and - * experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling the security of their systems and/or data - * to be ensured and, more generally, to use and operate it in the same conditions as regards security. - *

- * The fact that you are presently reading this means that you have had knowledge of the CeCILL 2.1 license and that you - * accept its terms. + * Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022) + * and the signatories of the "VITAM - Accord du Contributeur" agreement. + * + * contact@programmevitam.fr + * + * This software is a computer program whose purpose is to provide + * tools for construction and manipulation of SIP (Submission + * Information Package) conform to the SEDA (Standard d’Échange + * de données pour l’Archivage) standard. + * + * This software is governed by the CeCILL-C license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL-C + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.testsipgenerator; From 911667aaecffd76ed2c98f472aaf06f76c196722 Mon Sep 17 00:00:00 2001 From: Daniel Radeau Date: Fri, 6 Feb 2026 17:40:10 +0100 Subject: [PATCH 3/4] story #15307 code: apply java linter --- javalibpst/src/main/java/example/Test.java | 14 +- javalibpst/src/main/java/example/TestGui.java | 108 +- .../tools/javalibpst/DescriptorIndexNode.java | 40 +- .../fr/gouv/vitam/tools/javalibpst/LZFu.java | 17 +- .../tools/javalibpst/OffsetIndexItem.java | 33 +- .../vitam/tools/javalibpst/PSTActivity.java | 47 +- .../tools/javalibpst/PSTAppointment.java | 110 +- .../javalibpst/PSTAppointmentException.java | 167 +- .../javalibpst/PSTAppointmentRecurrence.java | 97 +- .../vitam/tools/javalibpst/PSTAttachment.java | 40 +- .../tools/javalibpst/PSTByteFileContent.java | 5 +- .../vitam/tools/javalibpst/PSTContact.java | 290 ++- .../javalibpst/PSTConversationIndex.java | 16 +- .../tools/javalibpst/PSTDescriptorItem.java | 51 +- .../vitam/tools/javalibpst/PSTDistList.java | 74 +- .../vitam/tools/javalibpst/PSTException.java | 3 +- .../gouv/vitam/tools/javalibpst/PSTFile.java | 153 +- .../tools/javalibpst/PSTFileContent.java | 7 +- .../vitam/tools/javalibpst/PSTFolder.java | 134 +- .../tools/javalibpst/PSTGlobalObjectId.java | 59 +- .../vitam/tools/javalibpst/PSTMessage.java | 96 +- .../tools/javalibpst/PSTMessageStore.java | 12 +- .../tools/javalibpst/PSTNodeInputStream.java | 25 +- .../vitam/tools/javalibpst/PSTObject.java | 486 +++-- .../tools/javalibpst/PSTRAFileContent.java | 11 +- .../vitam/tools/javalibpst/PSTRecipient.java | 14 +- .../gouv/vitam/tools/javalibpst/PSTRss.java | 39 +- .../gouv/vitam/tools/javalibpst/PSTTable.java | 92 +- .../vitam/tools/javalibpst/PSTTable7C.java | 313 ++-- .../tools/javalibpst/PSTTable7CItem.java | 2 +- .../vitam/tools/javalibpst/PSTTableBC.java | 156 +- .../tools/javalibpst/PSTTableBCItem.java | 2 +- .../vitam/tools/javalibpst/PSTTableItem.java | 17 +- .../gouv/vitam/tools/javalibpst/PSTTask.java | 78 +- .../vitam/tools/javalibpst/PSTTimeZone.java | 132 +- .../tools/javalibpst/AppointmentTest.java | 40 +- .../vitam/tools/javalibpst/DistListTest.java | 48 +- .../tools/javalibpst/PSTFileContentTest.java | 9 +- .../javalibpst/PSTGlobalObjectIdTest.java | 363 +++- .../vitam/tools/javalibpst/PasswordTest.java | 25 +- .../vitam/tools/javalibpst/Version36Test.java | 42 +- .../tools/mailextract/MailExtractApp.java | 297 +-- .../mailextract/MailExtractException.java | 8 +- .../mailextract/MailExtractGraphicApp.java | 96 +- .../tools/mailextract/MailExtractLogger.java | 58 +- .../mailextract/MailExtractMainWindow.java | 68 +- .../tools/mailextract/MailExtractThread.java | 70 +- .../vitam/tools/mailextract/package-info.java | 2 +- .../core/EmbeddedStoreExtractor.java | 1 - .../mailextractlib/core/StoreAppointment.java | 72 +- .../mailextractlib/core/StoreAttachment.java | 240 ++- .../mailextractlib/core/StoreContact.java | 68 +- .../mailextractlib/core/StoreElement.java | 32 +- .../mailextractlib/core/StoreExtractor.java | 363 ++-- .../core/StoreExtractorOptions.java | 43 +- .../mailextractlib/core/StoreFolder.java | 80 +- .../mailextractlib/core/StoreMessage.java | 343 ++-- .../mailextractlib/core/package-info.java | 2 +- .../formattools/HTMLTextExtractor.java | 47 +- .../formattools/TikaExtractor.java | 16 +- .../formattools/package-info.java | 2 +- .../formattools/rtf/CharsetUtils.java | 70 +- .../formattools/rtf/HTMLFromRTFExtractor.java | 47 +- .../formattools/rtf/RTFGroupState.java | 1 - .../formattools/rtf/package-info.java | 2 +- .../mailextractlib/nodes/ArchiveUnit.java | 232 ++- .../mailextractlib/nodes/MetadataPerson.java | 30 +- .../mailextractlib/nodes/MetadataXML.java | 4 +- .../mailextractlib/nodes/MetadataXMLList.java | 4 +- .../mailextractlib/nodes/MetadataXMLNode.java | 19 +- .../nodes/MetadataXMLSplittedNode.java | 22 +- .../nodes/MetadataXMLString.java | 22 +- .../mailextractlib/nodes/package-info.java | 2 +- .../store/javamail/JMEmbeddedStore.java | 5 +- .../store/javamail/JMMimeMessage.java | 1 + .../store/javamail/JMStoreExtractor.java | 142 +- .../store/javamail/JMStoreFolder.java | 104 +- .../store/javamail/JMStoreMessage.java | 282 +-- .../javamail/LFFixingQPDecoderStream.java | 4 +- .../charsets/OtherMimeCharsetProvider.java | 37 +- .../javamail/charsets/RedirectCharset.java | 2 +- .../javamail/charsets/jutf7/Base64Util.java | 124 +- .../charsets/jutf7/ModifiedUTF7Charset.java | 35 +- .../javamail/charsets/jutf7/UTF7Charset.java | 63 +- .../charsets/jutf7/UTF7StyleCharset.java | 121 +- .../jutf7/UTF7StyleCharsetDecoder.java | 267 ++- .../jutf7/UTF7StyleCharsetEncoder.java | 286 ++- .../store/javamail/eml/EmlFolder.java | 29 +- .../store/javamail/eml/EmlStore.java | 29 +- .../store/javamail/eml/package-info.java | 2 +- .../store/javamail/handlers/HandlerUtil.java | 74 +- .../handlers/SignatureContentHandler.java | 56 +- .../javamail/handlers/multipart_signed.java | 168 +- .../store/javamail/handlers/pgp.java | 16 +- .../store/javamail/handlers/pkcs7_mime.java | 18 +- .../javamail/handlers/pkcs7_signature.java | 18 +- .../store/javamail/handlers/x_pkcs7_mime.java | 18 +- .../javamail/handlers/x_pkcs7_signature.java | 77 +- .../store/javamail/mbox/MboxFolder.java | 51 +- .../store/javamail/mbox/MboxReader.java | 41 +- .../store/javamail/mbox/MboxStore.java | 28 +- .../store/javamail/mbox/package-info.java | 2 +- .../store/javamail/package-info.java | 2 +- .../thunderbird/ThunderbirdFolder.java | 196 +- .../thunderbird/ThunderbirdStore.java | 22 +- .../javamail/thunderbird/package-info.java | 2 +- .../microsoft/MicrosoftStoreElement.java | 50 +- .../microsoft/MicrosoftStoreMessage.java | 219 ++- .../MicrosoftStoreMessageAttachment.java | 4 +- .../microsoft/msg/MsgConversationIndex.java | 14 +- .../microsoft/msg/MsgStoreExtractor.java | 59 +- .../store/microsoft/msg/MsgStoreFolder.java | 25 +- .../store/microsoft/msg/MsgStoreMessage.java | 29 +- .../msg/MsgStoreMessageAttachment.java | 32 +- .../store/microsoft/msg/package-info.java | 2 +- .../store/microsoft/package-info.java | 2 +- .../microsoft/pst/PstStoreAppointment.java | 238 +-- .../store/microsoft/pst/PstStoreContact.java | 68 +- .../microsoft/pst/PstStoreExtractor.java | 135 +- .../store/microsoft/pst/PstStoreFolder.java | 137 +- .../store/microsoft/pst/PstStoreMessage.java | 27 +- .../PstEmbeddedStoreExtractor.java | 28 +- .../embeddedmsg/PstEmbeddedStoreFolder.java | 15 +- .../pst/embeddedmsg/package-info.java | 2 +- .../store/microsoft/pst/package-info.java | 2 +- .../tools/mailextractlib/utils/DateRange.java | 15 +- .../utils/HtmlAndXmlEscape.java | 533 +++--- .../utils/MailExtractLibException.java | 16 +- .../utils/MailExtractProgressLogger.java | 85 +- .../mailextractlib/utils/RFC822Headers.java | 86 +- .../mailextractlib/utils/RawDataSource.java | 5 +- .../mailextractlib/utils/package-info.java | 2 +- .../vitam/tools/mailextractlib/AllTests.java | 108 +- .../tools/mailextractlib/TestMetadata.java | 56 +- .../mailextractlib/TestTextExtraction.java | 43 +- .../tools/mailextractlib/TestUtilities.java | 153 +- .../store/TestEmlStoreExtractor.java | 197 +- .../store/TestMboxStoreExtractor.java | 170 +- .../store/TestMsgStoreExtractor.java | 85 +- .../store/TestPstStoreExtractor.java | 241 ++- .../gouv/vitam/tools/resip/app/ResipApp.java | 301 ++-- .../tools/resip/app/ResipGraphicApp.java | 952 ++++++---- .../vitam/tools/resip/app/package-info.java | 2 +- .../vitam/tools/resip/data/DustbinItem.java | 43 +- .../tools/resip/data/NullDeserializer.java | 8 +- .../vitam/tools/resip/data/StatisticData.java | 31 +- .../fr/gouv/vitam/tools/resip/data/Work.java | 65 +- .../vitam/tools/resip/data/package-info.java | 2 +- .../gouv/vitam/tools/resip/event/Event.java | 3 +- .../vitam/tools/resip/event/EventBus.java | 4 +- .../resip/event/SedaVersionChangedEvent.java | 1 + .../vitam/tools/resip/frame/AboutDialog.java | 87 +- .../tools/resip/frame/BigTextEditDialog.java | 38 +- .../vitam/tools/resip/frame/CleanDialog.java | 201 ++- .../resip/frame/CreationContextDialog.java | 329 ++-- .../tools/resip/frame/DuplicatesWindow.java | 308 ++-- .../resip/frame/ExportContextDialog.java | 1586 +++++++++-------- .../vitam/tools/resip/frame/ImagePanel.java | 13 +- .../vitam/tools/resip/frame/InOutDialog.java | 33 +- .../resip/frame/MailImportContextDialog.java | 571 +++--- .../vitam/tools/resip/frame/MainWindow.java | 38 +- .../resip/frame/ManifestFindToolBar.java | 3 +- .../tools/resip/frame/ManifestWindow.java | 15 +- .../tools/resip/frame/NumericFilter.java | 9 +- .../vitam/tools/resip/frame/SearchDialog.java | 56 +- .../tools/resip/frame/StatisticWindow.java | 86 +- .../resip/frame/TechnicalSearchDialog.java | 138 +- .../tools/resip/frame/TestDialogWindow.java | 91 +- .../tools/resip/frame/UsedTmpDirDialog.java | 25 +- .../resip/frame/UserInteractionDialog.java | 73 +- .../tools/resip/frame/VerifyDateDialog.java | 68 +- .../tools/resip/frame/XmlEditDialog.java | 110 +- .../vitam/tools/resip/frame/package-info.java | 2 +- .../frame/preferences/PreferencesDialog.java | 395 ++-- .../SedaConversionErrorHandler.java | 30 +- .../preferences/SedaVersionSelector.java | 4 +- .../vitam/tools/resip/inout/MailImporter.java | 76 +- .../vitam/tools/resip/inout/package-info.java | 2 +- .../resip/parameters/CSVImportContext.java | 34 +- .../parameters/CSVMetadataImportContext.java | 3 +- .../parameters/CSVTreeImportContext.java | 23 +- .../resip/parameters/CompactContext.java | 160 +- .../resip/parameters/CreationContext.java | 129 +- .../resip/parameters/DIPImportContext.java | 23 +- .../resip/parameters/DiskImportContext.java | 119 +- .../tools/resip/parameters/ExportContext.java | 1108 ++++++------ .../resip/parameters/InterfaceParameters.java | 24 +- .../resip/parameters/MailImportContext.java | 99 +- .../tools/resip/parameters/Preferences.java | 78 +- .../resip/parameters/SIPImportContext.java | 25 +- .../resip/parameters/TreatmentParameters.java | 296 ++- .../resip/parameters/ZipImportContext.java | 53 +- .../tools/resip/parameters/package-info.java | 1 - .../sedaobjecteditor/AnyXMLTypeEditor.java | 46 +- .../ArchiveUnitProfileEditor.java | 27 +- .../sedaobjecteditor/BooleanTypeEditor.java | 30 +- .../sedaobjecteditor/DateTimeTypeEditor.java | 40 +- .../sedaobjecteditor/DateTypeEditor.java | 18 +- .../sedaobjecteditor/DigestTypeEditor.java | 40 +- .../resip/sedaobjecteditor/DoubleFilter.java | 23 +- .../sedaobjecteditor/EnumTypeEditor.java | 41 +- .../resip/sedaobjecteditor/IntegerFilter.java | 23 +- .../sedaobjecteditor/IntegerTypeEditor.java | 29 +- .../LinearDimensionTypeEditor.java | 36 +- .../sedaobjecteditor/RelationshipEditor.java | 24 +- .../resip/sedaobjecteditor/RuleEditor.java | 84 +- .../sedaobjecteditor/SEDAObjectEditor.java | 128 +- .../SEDAObjectEditorConstants.java | 130 +- .../SIPInternalIDTypeEditor.java | 17 +- .../sedaobjecteditor/StringTypeEditor.java | 57 +- .../sedaobjecteditor/TextTypeEditor.java | 85 +- .../resip/sedaobjecteditor/WeightEditor.java | 32 +- .../StructuredArchiveUnitEditorPanel.java | 36 +- .../StructuredDataObjectGroupEditorPanel.java | 48 +- .../TreeDataObjectPackageEditorPanel.java | 169 +- .../XMLArchiveUnitEditorPanel.java | 43 +- .../XMLDataObjectGroupEditorPanel.java | 119 +- .../AutomaticGrowingTextArea.java | 21 +- .../structuredcomponents/ExtensionButton.java | 11 +- .../SEDAObjectEditorCompositePanel.java | 52 +- .../SEDAObjectEditorPanel.java | 6 +- .../SEDAObjectEditorSimplePanel.java | 11 +- .../structuredcomponents/ScrollablePanel.java | 140 +- .../viewers/DataObjectListCellRenderer.java | 76 +- .../DataObjectListTransferHandler.java | 60 +- .../viewers/DataObjectListViewer.java | 58 +- .../DataObjectPackageTreeCellRenderer.java | 50 +- .../viewers/DataObjectPackageTreeModel.java | 98 +- .../viewers/DataObjectPackageTreeNode.java | 115 +- ...ataObjectPackageTreeNodesTransferable.java | 125 +- .../DataObjectPackageTreeTransferHandler.java | 280 ++- .../viewers/DataObjectPackageTreeViewer.java | 195 +- .../DefaultTableHeaderCellRenderer.java | 19 +- .../viewers/DuplicatesTableModel.java | 55 +- .../viewers/StatisticCellRenderer.java | 35 +- .../viewers/StatisticTableModel.java | 24 +- .../AbstractUnitaryDataObjectEditor.java | 63 +- .../composite/ArchiveUnitEditor.java | 42 +- .../composite/BinaryDataObjectEditor.java | 140 +- .../composite/ComplexListTypeEditor.java | 131 +- .../composite/CompositeEditor.java | 14 +- .../composite/DataObjectGroupEditor.java | 82 +- .../composite/PhysicalDataObjectEditor.java | 15 +- .../composite/RuleTypeEditor.java | 85 +- .../vitam/tools/resip/threads/AddThread.java | 95 +- .../threads/ChangeSeda2VersionThread.java | 36 +- .../resip/threads/CheckEndDateThread.java | 56 +- .../resip/threads/CheckProfileThread.java | 42 +- .../tools/resip/threads/CleanThread.java | 41 +- .../tools/resip/threads/CompactThread.java | 92 +- .../tools/resip/threads/DeCompactThread.java | 87 +- .../tools/resip/threads/DuplicatesThread.java | 83 +- .../tools/resip/threads/ExpandThread.java | 119 +- .../tools/resip/threads/ExportThread.java | 156 +- .../tools/resip/threads/ImportThread.java | 221 ++- .../resip/threads/MailExtractThread.java | 164 +- .../tools/resip/threads/SearchThread.java | 51 +- .../resip/threads/SeeManifestThread.java | 55 +- .../tools/resip/threads/StatisticThread.java | 98 +- .../resip/threads/TechnicalSearchThread.java | 66 +- .../tools/resip/threads/package-info.java | 2 +- .../tools/resip/utils/ResipException.java | 21 +- .../vitam/tools/resip/utils/ResipLogger.java | 73 +- .../vitam/tools/resip/utils/package-info.java | 2 +- .../gouv/vitam/tools/resip/TestUtilities.java | 73 +- .../gouv/vitam/tools/resip/UseTestFiles.java | 1 - .../resip/parameters/ExportContextTest.java | 33 +- .../tools/resip/parameters/WorkTest.java | 121 +- .../AllMetadataEditorTest.java | 23 +- .../DataObjectGroupEditorTest.java | 124 +- .../StructuredArchiveUnitEditorPanelTest.java | 26 +- ...ucturedDataObjectGroupEditorPanelTest.java | 25 +- .../XMLArchiveUnitEditorPanelTest.java | 26 +- .../gouv/vitam/tools/sedalibsamples/App.java | 13 +- .../vitam/tools/sedalibsamples/Sample1.java | 15 +- .../vitam/tools/sedalibsamples/Sample2.java | 93 +- .../vitam/tools/sedalibsamples/Sample3.java | 93 +- .../tools/sedalibsamples/Sample3plus.java | 59 +- .../vitam/tools/sedalibsamples/Sample4.java | 39 +- .../core/AbstractUnitaryDataObject.java | 98 +- .../core/ArchiveDeliveryRequestReply.java | 187 +- .../tools/sedalib/core/ArchiveTransfer.java | 148 +- .../vitam/tools/sedalib/core/ArchiveUnit.java | 235 ++- .../sedalib/core/ArchiveUnitRefList.java | 35 +- .../tools/sedalib/core/BinaryDataObject.java | 120 +- .../vitam/tools/sedalib/core/DataObject.java | 3 +- .../tools/sedalib/core/DataObjectGroup.java | 111 +- .../tools/sedalib/core/DataObjectPackage.java | 494 +++-- .../core/DataObjectPackageIdElement.java | 20 +- .../tools/sedalib/core/DataObjectRefList.java | 34 +- .../tools/sedalib/core/GlobalMetadata.java | 413 ++--- .../sedalib/core/PhysicalDataObject.java | 20 +- .../json/DataObjectPackageDeserializer.java | 19 +- .../json/DataObjectPackageSerializer.java | 7 +- .../tools/sedalib/core/json/package-info.java | 2 +- .../tools/sedalib/core/package-info.java | 2 +- .../tools/sedalib/core/seda/SedaContext.java | 1 + .../core/seda/SedaVersionConverter.java | 35 +- .../droid/ContainerDroidIdentifier.java | 22 +- .../tools/sedalib/droid/DroidIdentifier.java | 154 +- .../tools/sedalib/droid/package-info.java | 2 +- .../vitam/tools/sedalib/inout/SIPBuilder.java | 318 ++-- .../ArchiveTransferToDiskExporter.java | 39 +- .../ArchiveTransferToSIPExporter.java | 76 +- ...ataObjectPackageToCSVMetadataExporter.java | 502 +++--- .../DataObjectPackageToDiskExporter.java | 263 +-- .../sedalib/inout/exporter/package-info.java | 2 +- .../inout/importer/CSVMetadataFormatter.java | 109 +- ...SVMetadataToDataObjectPackageImporter.java | 182 +- .../CSVTreeToDataObjectPackageImporter.java | 95 +- ...mpressedFileToArchiveTransferImporter.java | 126 +- ...ToArchiveDeliveryRequestReplyImporter.java | 115 +- .../DiskToArchiveTransferImporter.java | 88 +- .../DiskToDataObjectPackageImporter.java | 356 ++-- .../SIPToArchiveTransferImporter.java | 109 +- .../inout/importer/WindowsShortcut.java | 30 +- .../sedalib/inout/importer/package-info.java | 2 +- .../tools/sedalib/inout/package-info.java | 2 +- .../sedalib/metadata/ManagementMetadata.java | 28 +- .../tools/sedalib/metadata/Operation.java | 11 +- .../tools/sedalib/metadata/SEDAMetadata.java | 53 +- .../sedalib/metadata/compacted/Document.java | 6 +- .../metadata/compacted/DocumentContainer.java | 15 +- .../metadata/compacted/DocumentPack.java | 15 +- .../metadata/compacted/FileObject.java | 7 +- .../sedalib/metadata/compacted/RecordGrp.java | 12 +- .../metadata/compacted/SubDocument.java | 3 +- .../metadata/content/AdditionalProof.java | 6 +- .../sedalib/metadata/content/Content.java | 104 +- .../sedalib/metadata/content/Coverage.java | 1 - .../metadata/content/CustodialHistory.java | 9 +- .../metadata/content/DataObjectReference.java | 13 +- .../tools/sedalib/metadata/content/Event.java | 25 +- .../tools/sedalib/metadata/content/Gps.java | 17 +- .../content/PersistentIdentifier.java | 32 +- .../metadata/content/ReferencedObject.java | 7 +- .../content/RelatedObjectReference.java | 1 - .../tools/sedalib/metadata/content/Rule.java | 17 +- .../content/SignatureDescription.java | 26 +- .../sedalib/metadata/content/Signer.java | 16 +- .../metadata/content/SigningInformation.java | 34 +- .../content/TimestampingInformation.java | 13 +- .../metadata/content/package-info.java | 2 +- .../tools/sedalib/metadata/data/FileInfo.java | 28 +- .../metadata/data/FormatIdentification.java | 11 +- .../sedalib/metadata/data/Relationship.java | 34 +- .../tools/sedalib/metadata/data/Weight.java | 41 +- .../sedalib/metadata/data/package-info.java | 2 +- .../metadata/management/AccessRule.java | 5 +- .../metadata/management/AppraisalRule.java | 4 +- .../management/ArchiveUnitIdentifierKey.java | 10 +- .../management/ClassificationRule.java | 11 +- .../management/DisseminationRule.java | 4 +- .../sedalib/metadata/management/HoldRule.java | 12 +- .../sedalib/metadata/management/LogBook.java | 11 +- .../metadata/management/Management.java | 38 +- .../metadata/management/ReuseRule.java | 4 +- .../metadata/management/StorageRule.java | 7 +- .../metadata/management/UpdateOperation.java | 16 +- .../metadata/management/package-info.java | 2 +- .../metadata/namedtype/AgencyType.java | 4 +- .../sedalib/metadata/namedtype/AgentType.java | 14 +- .../metadata/namedtype/AnyXMLListType.java | 9 +- .../metadata/namedtype/AnyXMLType.java | 10 +- .../metadata/namedtype/BooleanType.java | 35 +- .../namedtype/ComplexListInterface.java | 253 ++- .../namedtype/ComplexListMetadataKind.java | 1 + .../namedtype/ComplexListMetadataMap.java | 2 +- .../metadata/namedtype/ComplexListType.java | 12 +- .../DataObjectOrArchiveUnitReferenceType.java | 7 +- .../metadata/namedtype/DateTimeType.java | 119 +- .../sedalib/metadata/namedtype/DateType.java | 33 +- .../metadata/namedtype/DigestType.java | 24 +- .../sedalib/metadata/namedtype/EnumType.java | 63 +- .../metadata/namedtype/EnumTypeConstants.java | 35 +- .../namedtype/InnerIdentifierType.java | 4 +- .../metadata/namedtype/IntegerType.java | 38 +- .../namedtype/LinearDimensionType.java | 52 +- .../namedtype/LinkingAgentIdentifier.java | 26 +- .../sedalib/metadata/namedtype/PlaceType.java | 6 +- .../metadata/namedtype/RuleMetadataKind.java | 1 - .../sedalib/metadata/namedtype/RuleType.java | 90 +- .../metadata/namedtype/SIPInternalIDType.java | 19 +- .../metadata/namedtype/StringType.java | 19 +- .../sedalib/metadata/namedtype/TextType.java | 26 +- .../metadata/namedtype/package-info.java | 2 +- .../tools/sedalib/metadata/package-info.java | 2 +- .../tools/sedalib/process/Compactor.java | 268 +-- .../tools/sedalib/process/DeCompactor.java | 240 ++- .../tools/sedalib/process/package-info.java | 2 +- .../tools/sedalib/utils/CompressUtility.java | 87 +- .../sedalib/utils/LocalDateTimeUtil.java | 5 +- .../tools/sedalib/utils/SEDALibException.java | 2 +- .../sedalib/utils/SEDALibProgressLogger.java | 54 +- .../utils/digest/DigestProgressLogger.java | 17 +- .../sedalib/utils/digest/DigestSha512.java | 3 +- .../utils/digest/NioDigestComputer.java | 15 +- .../tools/sedalib/utils/package-info.java | 2 +- .../tools/sedalib/xml/HtmlAndXmlEscape.java | 533 +++--- .../tools/sedalib/xml/IndentXMLTool.java | 40 +- .../tools/sedalib/xml/SEDAXMLEventReader.java | 135 +- .../sedalib/xml/SEDAXMLStreamWriter.java | 63 +- .../tools/sedalib/xml/SEDAXMLValidator.java | 47 +- .../vitam/tools/sedalib/xml/package-info.java | 2 +- .../tools/sedalib/SedaContextExtension.java | 1 - .../vitam/tools/sedalib/TestUtilities.java | 72 +- .../vitam/tools/sedalib/UseTestFiles.java | 1 - .../sedalib/core/BinaryDataObjectTest.java | 254 +-- .../sedalib/core/DataObjectPackageTest.java | 880 ++++----- .../sedalib/core/GlobalMetadataTest.java | 80 +- .../sedalib/core/PhysicalDataObjectTest.java | 315 ++-- .../tools/sedalib/core/SEDA2VersionTest.java | 128 +- .../ArchiveTransferSerDeserializerTest.java | 95 +- .../core/seda/SedaVersionConverterTest.java | 19 +- .../sedalib/core/seda/SedaVersionTest.java | 11 +- ...rchiveDeliveryRequestReplyFromXmlTest.java | 157 +- .../inout/ArchiveTransferToFromXmlTest.java | 78 +- .../inout/CSVMetadataExporterTest.java | 128 +- ...tadataToDataObjectPackageImporterTest.java | 301 ++-- ...SVTreeToDataObjectPackageImporterTest.java | 106 +- .../inout/CompressedFileImportTest.java | 320 ++-- .../sedalib/inout/DiskImportExportTest.java | 417 +++-- .../sedalib/inout/SEDAValidationTest.java | 308 ++-- .../tools/sedalib/inout/SIPBuilderTest.java | 124 +- .../tools/sedalib/inout/SIPImportTest.java | 308 ++-- .../importer/CSVMetadataFormatterTest.java | 38 +- .../metadata/ArchiveUnitProfileTest.java | 4 +- .../tools/sedalib/metadata/ContentTest.java | 226 ++- .../tools/sedalib/metadata/DataTest.java | 50 +- .../metadata/ManagementMetadataTest.java | 11 +- .../sedalib/metadata/ManagementTest.java | 331 ++-- .../metadata/namedtype/DateTimeTypeTest.java | 9 +- .../tools/sedalib/process/CompactorTest.java | 62 +- .../sedalib/process/DeCompactorTest.java | 54 +- .../vitam/tools/sedalib/utils/ArchTests.java | 70 +- .../sedalib/utils/LocalDateTimeUtilTest.java | 108 +- .../tools/sedalib/utils/ResourceUtils.java | 8 +- .../tools/sedalib/xml/SEDAValidationTest.java | 2 - .../testsipgenerator/TestSipGeneratorApp.java | 290 +-- 439 files changed, 21552 insertions(+), 16185 deletions(-) diff --git a/javalibpst/src/main/java/example/Test.java b/javalibpst/src/main/java/example/Test.java index 94e415ed..5f05f795 100644 --- a/javalibpst/src/main/java/example/Test.java +++ b/javalibpst/src/main/java/example/Test.java @@ -37,14 +37,15 @@ */ package example; -import java.util.Vector; - import fr.gouv.vitam.tools.javalibpst.PSTException; import fr.gouv.vitam.tools.javalibpst.PSTFile; import fr.gouv.vitam.tools.javalibpst.PSTFolder; import fr.gouv.vitam.tools.javalibpst.PSTMessage; +import java.util.Vector; + public class Test { + public static void main(final String[] args) { new Test(args[0]); } @@ -84,7 +85,14 @@ public void processFolder(final PSTFolder folder) throws PSTException, java.io.I while (email != null) { if (!email.getMessageClass().equals("IPM.Note")) { this.printDepth(); - System.out.println("Email: [" + email.getMessageClass() + "]" + email.getDescriptorNodeId() + " - " + email.getSubject()); + System.out.println( + "Email: [" + + email.getMessageClass() + + "]" + + email.getDescriptorNodeId() + + " - " + + email.getSubject() + ); } email = (PSTMessage) folder.getNextChild(); } diff --git a/javalibpst/src/main/java/example/TestGui.java b/javalibpst/src/main/java/example/TestGui.java index baa02700..c65a3b79 100644 --- a/javalibpst/src/main/java/example/TestGui.java +++ b/javalibpst/src/main/java/example/TestGui.java @@ -41,20 +41,7 @@ package example; -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Frame; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Vector; +import fr.gouv.vitam.tools.javalibpst.*; import javax.swing.JFileChooser; import javax.swing.JFrame; @@ -75,14 +62,27 @@ import javax.swing.table.AbstractTableModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; - -import fr.gouv.vitam.tools.javalibpst.*; +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; /** * @author toweruser * */ public class TestGui implements ActionListener { + private PSTFile pstFile; private EmailTableModel emailTableModel; private JTextPane emailText; @@ -94,7 +94,6 @@ public class TestGui implements ActionListener { private JFrame f; public TestGui(String filename) throws PSTException, IOException { - // setup the basic window this.f = new JFrame("PST Browser"); @@ -118,14 +117,26 @@ public TestGui(String filename) throws PSTException, IOException { final JTree folderTree = new JTree(top) { @Override - public String convertValueToText(final Object value, final boolean selected, final boolean expanded, - final boolean leaf, final int row, final boolean hasFocus) { + public String convertValueToText( + final Object value, + final boolean selected, + final boolean expanded, + final boolean leaf, + final int row, + final boolean hasFocus + ) { final DefaultMutableTreeNode nodeValue = (DefaultMutableTreeNode) value; if (nodeValue.getUserObject() instanceof PSTFolder) { final PSTFolder folderValue = (PSTFolder) nodeValue.getUserObject(); - return folderValue.getDescriptorNodeId() + " - " + folderValue.getDisplayName() + " " - + folderValue.getAssociateContentCount() + ""; + return ( + folderValue.getDescriptorNodeId() + + " - " + + folderValue.getDisplayName() + + " " + + folderValue.getAssociateContentCount() + + "" + ); } else if (nodeValue.getUserObject() instanceof PSTMessageStore) { final PSTMessageStore folderValue = (PSTMessageStore) nodeValue.getUserObject(); return folderValue.getDisplayName(); @@ -167,7 +178,9 @@ public String convertValueToText(final Object value, final boolean selected, fin final ListSelectionModel selectionModel = emailTable.getSelectionModel(); selectionModel.addListSelectionListener(e -> { final JTable source = emailTable; - TestGui.this.selectedMessage = TestGui.this.emailTableModel.getMessageAtRow(source.convertRowIndexToModel(source.getSelectedRow())); + TestGui.this.selectedMessage = TestGui.this.emailTableModel.getMessageAtRow( + source.convertRowIndexToModel(source.getSelectedRow()) + ); if (TestGui.this.selectedMessage instanceof PSTContact) { final PSTContact contact = (PSTContact) TestGui.this.selectedMessage; TestGui.this.emailText.setText(contact.toString()); @@ -218,8 +231,11 @@ public String convertValueToText(final Object value, final boolean selected, fin this.emailPanel.add(this.attachPanel, BorderLayout.NORTH); this.emailPanel.add(this.emailText, BorderLayout.CENTER); - final JSplitPane emailSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, emailTablePanel, - new JScrollPane(this.emailPanel)); + final JSplitPane emailSplitPane = new JSplitPane( + JSplitPane.VERTICAL_SPLIT, + emailTablePanel, + new JScrollPane(this.emailPanel) + ); emailSplitPane.setOneTouchExpandable(true); emailSplitPane.setDividerLocation(0.25); @@ -251,8 +267,7 @@ private void buildTree(final DefaultMutableTreeNode top, final PSTFolder theFold if (folder.getSubFolders().size() > 0) { this.buildTree(node, folder); - } else { - } + } else {} top.add(node); } } catch (final Exception err) { @@ -281,8 +296,7 @@ void setAttachmentText() { } } } - } catch (final Exception e) { - } + } catch (final Exception e) {} this.attachText.setText(s.toString()); } @@ -291,7 +305,6 @@ void selectFolder(final PSTFolder folder) throws IOException, PSTException { // load up the non-folder children. this.emailTableModel.setFolder(folder); - } public JMenuBar createMenu() { @@ -369,7 +382,6 @@ private void saveAttachments() { public static void main(final String[] args) throws PSTException, IOException { new TestGui(args[0]); } - } class EmailTableModel extends AbstractTableModel { @@ -382,7 +394,6 @@ class EmailTableModel extends AbstractTableModel { public EmailTableModel(final PSTFolder theFolder, final PSTFile theFile) { super(); - this.theFolder = theFolder; this.theFile = theFile; } @@ -416,12 +427,12 @@ public int getRowCount() { public PSTMessage getMessageAtRow(final int row) { PSTMessage next = null; try { - if (this.cache.containsKey(((Object)theFolder)+toString()+" - "+row)) { - next = (PSTMessage) this.cache.get(((Object)theFolder)+toString()+" - "+row); + if (this.cache.containsKey(((Object) theFolder) + toString() + " - " + row)) { + next = (PSTMessage) this.cache.get(((Object) theFolder) + toString() + " - " + row); } else { this.theFolder.moveChildCursorTo(row); next = (PSTMessage) this.theFolder.getNextChild(); - this.cache.put(((Object)theFolder)+toString()+" - "+row, next); + this.cache.put(((Object) theFolder) + toString() + " - " + row, next); } } catch (final Exception e) { e.printStackTrace(); @@ -440,24 +451,24 @@ public Object getValueAt(final int row, final int col) { } switch (col) { - case 0: - return next.getDescriptorNode().descriptorIdentifier + ""; + case 0: + return next.getDescriptorNode().descriptorIdentifier + ""; case 1: return next.getMessageClass(); case 2: return next.getSubject(); - case 3: - return next.getSentRepresentingName() + " <" + next.getSentRepresentingEmailAddress() + ">"; - case 4: - return next.getReceivedByName() + " <" + next.getReceivedByAddress() + ">" + next.getDisplayTo(); - case 5: - return next.getClientSubmitTime(); - // return next.isFlagged(); - // return next.isDraft(); - // PSTTask task = next.toTask(); - // return task.toString(); - case 6: - return (next.hasAttachments() ? "Yes" : "No"); + case 3: + return next.getSentRepresentingName() + " <" + next.getSentRepresentingEmailAddress() + ">"; + case 4: + return next.getReceivedByName() + " <" + next.getReceivedByAddress() + ">" + next.getDisplayTo(); + case 5: + return next.getClientSubmitTime(); + // return next.isFlagged(); + // return next.isDraft(); + // PSTTask task = next.toTask(); + // return task.toString(); + case 6: + return (next.hasAttachments() ? "Yes" : "No"); } } catch (final Exception e) { e.printStackTrace(); @@ -482,5 +493,4 @@ public void setFolder(final PSTFolder theFolder) throws PSTException, IOExceptio this.theFolder = theFolder; this.fireTableDataChanged(); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java index b39b0fc3..effa5bb5 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/DescriptorIndexNode.java @@ -42,10 +42,11 @@ /** * DescriptorIndexNode is a leaf item from the Descriptor index b-tree * It is like a pointer to an element in the PST file, everything has one... - * + * * @author Richard Johnson */ public class DescriptorIndexNode { + public int descriptorIdentifier; public long dataOffsetIndexIdentifier; public long localDescriptorsOffsetIndexIdentifier; @@ -96,14 +97,33 @@ PSTNodeInputStream getNodeInputStream(final PSTFile pstFile) throws IOException, @Override public String toString() { - - return "DescriptorIndexNode\n" + "Descriptor Identifier: " + this.descriptorIdentifier + " (0x" - + Long.toHexString(this.descriptorIdentifier) + ")\n" + "Data offset identifier: " - + this.dataOffsetIndexIdentifier + " (0x" + Long.toHexString(this.dataOffsetIndexIdentifier) + ")\n" - + "Local descriptors offset index identifier: " + this.localDescriptorsOffsetIndexIdentifier + " (0x" - + Long.toHexString(this.localDescriptorsOffsetIndexIdentifier) + ")\n" - + "Parent Descriptor Index Identifier: " + this.parentDescriptorIndexIdentifier + " (0x" - + Long.toHexString(this.parentDescriptorIndexIdentifier) + ")\n" + "Item Type: " + this.itemType + " (0x" - + Long.toHexString(this.itemType) + ")"; + return ( + "DescriptorIndexNode\n" + + "Descriptor Identifier: " + + this.descriptorIdentifier + + " (0x" + + Long.toHexString(this.descriptorIdentifier) + + ")\n" + + "Data offset identifier: " + + this.dataOffsetIndexIdentifier + + " (0x" + + Long.toHexString(this.dataOffsetIndexIdentifier) + + ")\n" + + "Local descriptors offset index identifier: " + + this.localDescriptorsOffsetIndexIdentifier + + " (0x" + + Long.toHexString(this.localDescriptorsOffsetIndexIdentifier) + + ")\n" + + "Parent Descriptor Index Identifier: " + + this.parentDescriptorIndexIdentifier + + " (0x" + + Long.toHexString(this.parentDescriptorIndexIdentifier) + + ")\n" + + "Item Type: " + + this.itemType + + " (0x" + + Long.toHexString(this.itemType) + + ")" + ); } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java index 416d7340..52338678 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/LZFu.java @@ -41,15 +41,15 @@ /** * An implementation of the LZFu algorithm to decompress RTF content - * + * * @author Richard Johnson */ public class LZFu { - public static final String LZFU_HEADER = "{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx"; + public static final String LZFU_HEADER = + "{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx"; public static String decode(final byte[] data) throws PSTException { - @SuppressWarnings("unused") final int compressedSize = (int) PSTObject.convertLittleEndianBytesToLong(data, 0, 4); final int uncompressedSize = (int) PSTObject.convertLittleEndianBytesToLong(data, 4, 8); @@ -100,7 +100,6 @@ public static String decode(final byte[] data) throws PSTException { } catch (final Exception e) { e.printStackTrace(); } - } else { // copy the byte over lzBuffer[bufferPosition] = data[currentDataPosition]; @@ -112,11 +111,15 @@ public static String decode(final byte[] data) throws PSTException { } if (outputPosition != uncompressedSize) { - throw new PSTException(String.format("Error decompressing RTF! Expected %d bytes, got %d bytes\n", - uncompressedSize, outputPosition)); + throw new PSTException( + String.format( + "Error decompressing RTF! Expected %d bytes, got %d bytes\n", + uncompressedSize, + outputPosition + ) + ); } return new String(output).trim(); - } else if (compressionSig == 0x414c454d) { // we are not compressed! // just return the rest of the contents as a string diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java index b73bcd93..fd5f5985 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/OffsetIndexItem.java @@ -40,10 +40,11 @@ /** * OffsetIndexItem is a leaf item from the Offset index b-tree * Only really used internally to get the file offset for items - * + * * @author Richard Johnson */ class OffsetIndexItem { + long indexIdentifier; long fileOffset; int size; @@ -67,10 +68,30 @@ class OffsetIndexItem { @Override public String toString() { - return "OffsetIndexItem\n" + "Index Identifier: " + this.indexIdentifier + " (0x" - + Long.toHexString(this.indexIdentifier) + ")\n" + "File Offset: " + this.fileOffset + " (0x" - + Long.toHexString(this.fileOffset) + ")\n" + "cRef: " + this.cRef + " (0x" + Long.toHexString(this.cRef) - + " bin:" + Long.toBinaryString(this.cRef) + ")\n" + "Size: " + this.size + " (0x" - + Long.toHexString(this.size) + ")"; + return ( + "OffsetIndexItem\n" + + "Index Identifier: " + + this.indexIdentifier + + " (0x" + + Long.toHexString(this.indexIdentifier) + + ")\n" + + "File Offset: " + + this.fileOffset + + " (0x" + + Long.toHexString(this.fileOffset) + + ")\n" + + "cRef: " + + this.cRef + + " (0x" + + Long.toHexString(this.cRef) + + " bin:" + + Long.toBinaryString(this.cRef) + + ")\n" + + "Size: " + + this.size + + " (0x" + + Long.toHexString(this.size) + + ")" + ); } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java index 013b64c9..87c6124d 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTActivity.java @@ -69,8 +69,12 @@ public PSTActivity(final PSTFile theFile, final DescriptorIndexNode descriptorIn * @param table the table * @param localDescriptorItems the local descriptor items */ - public PSTActivity(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + public PSTActivity( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -166,13 +170,36 @@ public String getLogTypeDesc() { @Override public String toString() { - return "Type ASCII or Unicode string: " + this.getLogType() + "\n" + "Start Filetime: " + this.getLogStart() - + "\n" + "Duration Integer 32-bit signed: " + this.getLogDuration() + "\n" + "End Filetime: " - + this.getLogEnd() + "\n" + "LogFlags Integer 32-bit signed: " + this.getLogFlags() + "\n" - + "DocPrinted Boolean: " + this.isDocumentPrinted() + "\n" + "DocSaved Boolean: " + this.isDocumentSaved() - + "\n" + "DocRouted Boolean: " + this.isDocumentRouted() + "\n" + "DocPosted Boolean: " - + this.isDocumentPosted() + "\n" + "TypeDescription ASCII or Unicode string: " + this.getLogTypeDesc(); - + return ( + "Type ASCII or Unicode string: " + + this.getLogType() + + "\n" + + "Start Filetime: " + + this.getLogStart() + + "\n" + + "Duration Integer 32-bit signed: " + + this.getLogDuration() + + "\n" + + "End Filetime: " + + this.getLogEnd() + + "\n" + + "LogFlags Integer 32-bit signed: " + + this.getLogFlags() + + "\n" + + "DocPrinted Boolean: " + + this.isDocumentPrinted() + + "\n" + + "DocSaved Boolean: " + + this.isDocumentSaved() + + "\n" + + "DocRouted Boolean: " + + this.isDocumentRouted() + + "\n" + + "DocPosted Boolean: " + + this.isDocumentPosted() + + "\n" + + "TypeDescription ASCII or Unicode string: " + + this.getLogTypeDesc() + ); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java index 1ef3240d..182b9800 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointment.java @@ -50,12 +50,16 @@ public class PSTAppointment extends PSTMessage { PSTAppointment(final PSTFile theFile, final DescriptorIndexNode descriptorIndexNode) - throws PSTException, IOException { + throws PSTException, IOException { super(theFile, descriptorIndexNode); } - PSTAppointment(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + PSTAppointment( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -81,7 +85,9 @@ public Date getStartTime() { public LocalDateTime getLocalStartTime() { return this.getDateItem(this.pstFile.getNameToIdMapItem(0x0000820d, PSTFile.PSETID_Appointment)) - .toInstant().atZone(getStartTimeZone().getSimpleTimeZone().toZoneId()).toLocalDateTime(); + .toInstant() + .atZone(getStartTimeZone().getSimpleTimeZone().toZoneId()) + .toLocalDateTime(); } public PSTTimeZone getStartTimeZone() { @@ -94,7 +100,9 @@ public Date getEndTime() { public LocalDateTime getLocalEndTime() { return this.getDateItem(this.pstFile.getNameToIdMapItem(0x0000820e, PSTFile.PSETID_Appointment)) - .toInstant().atZone(getStartTimeZone().getSimpleTimeZone().toZoneId()).toLocalDateTime(); + .toInstant() + .atZone(getStartTimeZone().getSimpleTimeZone().toZoneId()) + .toLocalDateTime(); } public PSTTimeZone getEndTimeZone() { @@ -103,10 +111,9 @@ public PSTTimeZone getEndTimeZone() { public PSTTimeZone getRecurrenceTimeZone() { String desc = this.getStringItem(this.pstFile.getNameToIdMapItem(0x00008234, PSTFile.PSETID_Appointment)); - final byte[] tzData = this - .getBinaryItem(this.pstFile.getNameToIdMapItem(0x00008233, PSTFile.PSETID_Appointment)); - if ((desc == null) || desc.isEmpty()) - desc = "Unknown"; + final byte[] tzData = + this.getBinaryItem(this.pstFile.getNameToIdMapItem(0x00008233, PSTFile.PSETID_Appointment)); + if ((desc == null) || desc.isEmpty()) desc = "Unknown"; if (tzData != null && tzData.length != 0) { return new PSTTimeZone(desc, tzData); } @@ -235,20 +242,15 @@ public int getLocaleId() { } public PSTGlobalObjectId getGlobalObjectId() { - byte[] tmp = this.getBinaryItem(this.pstFile.getNameToIdMapItem(0x00000003, PSTFile.PSETID_Meeting)); - if (tmp != null) - return new PSTGlobalObjectId(tmp); - else - return null; + if (tmp != null) return new PSTGlobalObjectId(tmp); + else return null; } public PSTGlobalObjectId getCleanGlobalObjectId() { byte[] tmp = this.getBinaryItem(this.pstFile.getNameToIdMapItem(0x00000023, PSTFile.PSETID_Meeting)); - if (tmp != null) - return new PSTGlobalObjectId(tmp); - else - return null; + if (tmp != null) return new PSTGlobalObjectId(tmp); + else return null; } /** @@ -263,10 +265,8 @@ public static Date apptTimeToUTCDate(final int minutes, final PSTTimeZone tz) { final long ms_since_16010101 = minutes * (60 * 1000L); final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF; final long tzOffset; - if (tz == null) - tzOffset = 0; - else - tzOffset = tz.getSimpleTimeZone().getOffset(ms_since_19700101); + if (tz == null) tzOffset = 0; + else tzOffset = tz.getSimpleTimeZone().getOffset(ms_since_19700101); Date utcDate = new Date(ms_since_19700101 - tzOffset); return utcDate; @@ -274,18 +274,64 @@ public static Date apptTimeToUTCDate(final int minutes, final PSTTimeZone tz) { @Override public String toString() { - String result = "IDs:\n GlobalObjectID: " + getGlobalObjectId() + "\n CleanGlobalID: " + getCleanGlobalObjectId() + "\n" + - " LocaleID: " + getLocaleId() + "\n"; + String result = + "IDs:\n GlobalObjectID: " + + getGlobalObjectId() + + "\n CleanGlobalID: " + + getCleanGlobalObjectId() + + "\n" + + " LocaleID: " + + getLocaleId() + + "\n"; result += "Info:\n Subject: " + getSubject() + "\n Location: " + getLocation() + "\n"; - result += "Peoples:\n Required attendees: " + getRequiredAttendees() + "\n All attendees: " + getAllAttendees() + - "\n To attendees: " + getToAttendees() + "\n CC attendees: " + getCCAttendees() + "\n"; - result += "Flags:\n Busy:" + getShowAsBusy() + "\n MeetingStatus: " + getMeetingStatus() + "\n ResponseStatus: " + getResponseStatus() + "\n " + - "isRecursed: " + isRecurring() + "\n"; - result += "Time:\n Start: " + getStartTime() + " [TZ=" + (getStartTimeZone()==null?"Unknown":getStartTimeZone().getSimpleTimeZone()) + "]\n End: " + getEndTime() + " [TZ=" + (getEndTimeZone()==null?"Unknown":getEndTimeZone().getSimpleTimeZone()) + "]\n " + - "Duration: " + getDuration() + "\n"; - result += "Recurrence:\n Base: " + getRecurrenceBase() + "\n Type: " + getRecurrenceType() + "\n Pattern: " + getRecurrencePattern() + "\n"; + result += + "Peoples:\n Required attendees: " + + getRequiredAttendees() + + "\n All attendees: " + + getAllAttendees() + + "\n To attendees: " + + getToAttendees() + + "\n CC attendees: " + + getCCAttendees() + + "\n"; + result += + "Flags:\n Busy:" + + getShowAsBusy() + + "\n MeetingStatus: " + + getMeetingStatus() + + "\n ResponseStatus: " + + getResponseStatus() + + "\n " + + "isRecursed: " + + isRecurring() + + "\n"; + result += + "Time:\n Start: " + + getStartTime() + + " [TZ=" + + (getStartTimeZone() == null ? "Unknown" : getStartTimeZone().getSimpleTimeZone()) + + "]\n End: " + + getEndTime() + + " [TZ=" + + (getEndTimeZone() == null ? "Unknown" : getEndTimeZone().getSimpleTimeZone()) + + "]\n " + + "Duration: " + + getDuration() + + "\n"; + result += + "Recurrence:\n Base: " + + getRecurrenceBase() + + "\n Type: " + + getRecurrenceType() + + "\n Pattern: " + + getRecurrencePattern() + + "\n"; if (isRecurring()) { - PSTAppointmentRecurrence par = new PSTAppointmentRecurrence(getRecurrenceStructure(), this, getRecurrenceTimeZone()); + PSTAppointmentRecurrence par = new PSTAppointmentRecurrence( + getRecurrenceStructure(), + this, + getRecurrenceTimeZone() + ); result += par.toString() + "\n"; } result += "Others\n Color: " + getColor() + "\n"; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java index c0db8ea4..139a402e 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentException.java @@ -46,7 +46,7 @@ /** * Class containing information on exceptions to a recurring appointment - * + * * @author Orin Eman * * Improved using Microsoft document [MS-OXOCAL]: Appointment and Meeting Object Protocol @@ -83,7 +83,7 @@ public class PSTAppointmentException { private Date EndDate; private Date OriginalStartDate; - private int ChangeHighlightValue=-1; + private int ChangeHighlightValue = -1; private PSTAppointment embeddedMessage = null; private final PSTAppointment appt; private final int length; @@ -214,37 +214,52 @@ public PSTAppointment getEmbeddedMessage() { return this.embeddedMessage; } - PSTAppointmentException(final byte[] recurrencePattern, int offset, final int writerVersion2, - final PSTAppointment appt) { + PSTAppointmentException( + final byte[] recurrencePattern, + int offset, + final int writerVersion2, + final PSTAppointment appt + ) { this.writerVersion2 = writerVersion2; final int initialOffset = offset; this.appt = appt; this.embeddedMessage = null; - PSTTimeZone tz=appt.getRecurrenceTimeZone(); + PSTTimeZone tz = appt.getRecurrenceTimeZone(); // time in minutes from 1/1/1601 but local, converted to UTC time zone reference of the original appointment start - this.StartDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.StartDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; // time in minutes from 1/1/1601, converted to UTC time zone reference of the original appointment end - this.EndDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.EndDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; // time in minutes from 1/1/1601 but local, converted to UTC time zone reference of the original appointment start - this.OriginalStartDate=apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.OriginalStartDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; this.OverrideFlags = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 2); offset += 2; if ((this.OverrideFlags & ARO_SUBJECT) != 0) { offset += 2; - final short SubjectLength2 = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 2); + final short SubjectLength2 = (short) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 2 + ); offset += 2; - byte [] tmp = new byte[SubjectLength2]; + byte[] tmp = new byte[SubjectLength2]; System.arraycopy(recurrencePattern, offset, tmp, 0, SubjectLength2); try { - Subject=new String(tmp, "UTF-16LE"); - } catch (UnsupportedEncodingException ignored) { - } + Subject = new String(tmp, "UTF-16LE"); + } catch (UnsupportedEncodingException ignored) {} offset += SubjectLength2; } @@ -259,22 +274,24 @@ public PSTAppointment getEmbeddedMessage() { } if ((this.OverrideFlags & ARO_REMINDER) != 0) { - this.ReminderSet = ((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4) != 0); + this.ReminderSet = ((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4) != + 0); offset += 4; } if ((this.OverrideFlags & ARO_LOCATION) != 0) { offset += 2; - final short LocationLength2 = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 2); + final short LocationLength2 = (short) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 2 + ); offset += 2; - byte [] tmp = new byte[LocationLength2]; + byte[] tmp = new byte[LocationLength2]; System.arraycopy(recurrencePattern, offset, tmp, 0, LocationLength2); try { - Location=new String(tmp, "UTF-16LE"); - } catch (UnsupportedEncodingException ignored) { - } + Location = new String(tmp, "UTF-16LE"); + } catch (UnsupportedEncodingException ignored) {} offset += LocationLength2; } @@ -294,7 +311,11 @@ public PSTAppointment getEmbeddedMessage() { } if ((this.OverrideFlags & ARO_APPTCOLOR) != 0) { - this.AppointmentColor = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4); + this.AppointmentColor = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; } @@ -305,11 +326,17 @@ void ExtendedException(final byte[] recurrencePattern, int offset) { final int initialOffset = offset; if (this.writerVersion2 >= 0x00003009) { - final int ChangeHighlightSize = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + final int ChangeHighlightSize = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; - this.ChangeHighlightValue = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + this.ChangeHighlightValue = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += ChangeHighlightSize; } @@ -319,41 +346,54 @@ void ExtendedException(final byte[] recurrencePattern, int offset) { // See http://msdn.microsoft.com/en-us/library/cc979209(office.12).aspx if ((this.OverrideFlags & (ARO_SUBJECT | ARO_LOCATION)) != 0) { long tzoffset; - PSTTimeZone tz=appt.getRecurrenceTimeZone(); + PSTTimeZone tz = appt.getRecurrenceTimeZone(); // time in minutes from 1/1/1601 but local, converted to same time zone reference than the original appointment start - this.StartDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.StartDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; // time in minutes from 1/1/1601, converted to same time zone reference than the original appointment end - this.EndDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.EndDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; // time in minutes from 1/1/1601 but local, converted to same time zone reference than the original appointment start - this.OriginalStartDate=apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4),tz); + this.OriginalStartDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + tz + ); offset += 4; } if ((this.OverrideFlags & ARO_SUBJECT) != 0) { - int WideCharSubjectCharLength = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 2); + int WideCharSubjectCharLength = (short) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 2 + ); offset += 2; - byte [] WideCharSubject = new byte[WideCharSubjectCharLength * 2]; + byte[] WideCharSubject = new byte[WideCharSubjectCharLength * 2]; System.arraycopy(recurrencePattern, offset, WideCharSubject, 0, WideCharSubject.length); try { - Subject=new String(WideCharSubject, "UTF-16LE"); - } catch (UnsupportedEncodingException ignored) { - } + Subject = new String(WideCharSubject, "UTF-16LE"); + } catch (UnsupportedEncodingException ignored) {} offset += WideCharSubject.length; } if ((this.OverrideFlags & ARO_LOCATION) != 0) { - int WideCharLocationCharLength = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 2); + int WideCharLocationCharLength = (short) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 2 + ); offset += 2; - byte [] WideCharLocation = new byte[WideCharLocationCharLength * 2]; + byte[] WideCharLocation = new byte[WideCharLocationCharLength * 2]; System.arraycopy(recurrencePattern, offset, WideCharLocation, 0, WideCharLocation.length); try { - Location=new String(WideCharLocation, "UTF-16LE"); - } catch (UnsupportedEncodingException ignored) { - } + Location = new String(WideCharLocation, "UTF-16LE"); + } catch (UnsupportedEncodingException ignored) {} offset += WideCharLocation.length; } @@ -383,30 +423,23 @@ int getExtendedLength() { static DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME; @Override - public String toString(){ - String result=" OverrideFlags:"+Integer.toHexString(OverrideFlags)+"\n"; - - if ((OverrideFlags & ARO_SUBJECT)!=0) - result+=" Changed Subject: "+getSubject()+"\n"; - if ((OverrideFlags & ARO_MEETINGTYPE)!=0) - result+=" Changed MeetingType: "+getMeetingType()+"\n"; - if ((OverrideFlags & ARO_REMINDER)!=0) - result+=" Changed Reminder: "+getReminderSet()+"\n"; - if ((OverrideFlags & ARO_REMINDERDELTA)!=0) - result+=" Changed ReminderDelta: "+getReminderDelta()+"\n"; - if ((OverrideFlags & ARO_LOCATION)!=0) - result+=" Changed Location: "+getLocation()+"\n"; - if ((OverrideFlags & ARO_BUSYSTATUS)!=0) - result+=" Changed BusyStatus: "+getBusyStatus()+"\n"; - if ((OverrideFlags & ARO_SUBTYPE)!=0) - result+=" Changed SubType: "+getSubType()+"\n"; - if ((OverrideFlags & ARO_APPTCOLOR)!=0) - result+=" Changed ApptColor: "+getColor()+"\n"; - result+=" StartDate: "+getStartDate()+"\n"; - result+=" EndDate: "+getEndDate()+"\n"; - result+=" StartOriginalDate: "+getOriginalStartDate()+"\n"; - if (isEmbeddedMessagePresent()) - result+=" ChangedAppointment:\n "+getEmbeddedMessage().toString().replaceAll("\\n","\n "); + public String toString() { + String result = " OverrideFlags:" + Integer.toHexString(OverrideFlags) + "\n"; + + if ((OverrideFlags & ARO_SUBJECT) != 0) result += " Changed Subject: " + getSubject() + "\n"; + if ((OverrideFlags & ARO_MEETINGTYPE) != 0) result += " Changed MeetingType: " + getMeetingType() + "\n"; + if ((OverrideFlags & ARO_REMINDER) != 0) result += " Changed Reminder: " + getReminderSet() + "\n"; + if ((OverrideFlags & ARO_REMINDERDELTA) != 0) result += + " Changed ReminderDelta: " + getReminderDelta() + "\n"; + if ((OverrideFlags & ARO_LOCATION) != 0) result += " Changed Location: " + getLocation() + "\n"; + if ((OverrideFlags & ARO_BUSYSTATUS) != 0) result += " Changed BusyStatus: " + getBusyStatus() + "\n"; + if ((OverrideFlags & ARO_SUBTYPE) != 0) result += " Changed SubType: " + getSubType() + "\n"; + if ((OverrideFlags & ARO_APPTCOLOR) != 0) result += " Changed ApptColor: " + getColor() + "\n"; + result += " StartDate: " + getStartDate() + "\n"; + result += " EndDate: " + getEndDate() + "\n"; + result += " StartOriginalDate: " + getOriginalStartDate() + "\n"; + if (isEmbeddedMessagePresent()) result += + " ChangedAppointment:\n " + getEmbeddedMessage().toString().replaceAll("\\n", "\n "); return result; } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java index c5b3f0d6..da2a7e3d 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAppointmentRecurrence.java @@ -37,11 +37,6 @@ */ package fr.gouv.vitam.tools.javalibpst; -/* - * import java.text.SimpleDateFormat; - * / - **/ - import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; @@ -174,27 +169,33 @@ public int getEndTimeOffset() { public PSTAppointmentRecurrence(final byte[] recurrencePattern, final PSTAppointment appt, final PSTTimeZone tz) { this.RecurrenceTimeZone = tz; final SimpleTimeZone stz; - if (tz==null) - stz=PSTTimeZone.utcTimeZone; - else - stz=this.RecurrenceTimeZone.getSimpleTimeZone(); + if (tz == null) stz = PSTTimeZone.utcTimeZone; + else stz = this.RecurrenceTimeZone.getSimpleTimeZone(); // Read the structure this.RecurFrequency = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 4, 6); this.PatternType = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 6, 8); this.CalendarType = (short) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 8, 10); - this.FirstDateTime = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 10, 14), - this.RecurrenceTimeZone); + this.FirstDateTime = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 10, 14), + this.RecurrenceTimeZone + ); this.Period = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 14, 18); this.SlidingFlag = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, 18, 22); int offset = 22; if (this.PatternType != 0) { - this.PatternSpecific = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + this.PatternSpecific = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; if (this.PatternType == 0x0003 || this.PatternType == 0x000B) { - this.PatternSpecificNth = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + this.PatternSpecificNth = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; } } @@ -205,33 +206,45 @@ public PSTAppointmentRecurrence(final byte[] recurrencePattern, final PSTAppoint this.FirstDOW = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4); offset += 4; - this.DeletedInstanceCount = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + this.DeletedInstanceCount = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; this.DeletedInstanceDates = new Date[this.DeletedInstanceCount]; for (int i = 0; i < this.DeletedInstanceCount; ++i) { this.DeletedInstanceDates[i] = apptTimeToUTCDate( - (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), - this.RecurrenceTimeZone); + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + this.RecurrenceTimeZone + ); offset += 4; } - this.ModifiedInstanceCount = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + this.ModifiedInstanceCount = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4; this.ModifiedInstanceDates = new Date[this.ModifiedInstanceCount]; for (int i = 0; i < this.ModifiedInstanceCount; ++i) { this.ModifiedInstanceDates[i] = apptTimeToUTCDate( - (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), - this.RecurrenceTimeZone); + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + this.RecurrenceTimeZone + ); offset += 4; } - this.StartDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), - this.RecurrenceTimeZone); + this.StartDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + this.RecurrenceTimeZone + ); offset += 4; - this.EndDate = apptTimeToUTCDate((int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), - this.RecurrenceTimeZone); + this.EndDate = apptTimeToUTCDate( + (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4), + this.RecurrenceTimeZone + ); offset += 4 + 4; // Skip ReaderVersion2 this.writerVersion2 = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, offset + 4); @@ -252,8 +265,11 @@ public PSTAppointmentRecurrence(final byte[] recurrencePattern, final PSTAppoint } if ((offset + 4) <= recurrencePattern.length) { - final int ReservedBlock1Size = (int) PSTObject.convertLittleEndianBytesToLong(recurrencePattern, offset, - offset + 4); + final int ReservedBlock1Size = (int) PSTObject.convertLittleEndianBytesToLong( + recurrencePattern, + offset, + offset + 4 + ); offset += 4 + (ReservedBlock1Size * 4); } @@ -272,8 +288,10 @@ public PSTAppointmentRecurrence(final byte[] recurrencePattern, final PSTAppoint f.setTimeZone(stz); final Calendar c = Calendar.getInstance(stz); - for (int i = 0; i < this.ExceptionCount; ++i) - modifiedDateMap.put(f.format(ModifiedInstanceDates[i].getTime()), Exceptions[i]); + for (int i = 0; i < this.ExceptionCount; ++i) modifiedDateMap.put( + f.format(ModifiedInstanceDates[i].getTime()), + Exceptions[i] + ); for (int i = 0; i < appt.getNumberOfAttachments(); i++) { try { @@ -284,33 +302,28 @@ public PSTAppointmentRecurrence(final byte[] recurrencePattern, final PSTAppoint embeddedMessage = (PSTAppointment) message; c.setTime(embeddedMessage.getRecurrenceBase()); PSTAppointmentException modifiedException = modifiedDateMap.get(f.format(c.getTime())); - if (modifiedException == null) - continue; + if (modifiedException == null) continue; modifiedException.setEmbeddedMessage(embeddedMessage); - - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } - @Override public String toString() { String result; result = " Start date:" + getStartDate(); result += "\n End date:" + getEndDate(); result += "\n Changes:"; - result += "\n " + getExceptionCount() + " exceptions" ; + result += "\n " + getExceptionCount() + " exceptions"; result += "\n " + getDeletedInstanceDates().length + " delete"; - for (Date d : getDeletedInstanceDates()) - result += "\n " + d.toString(); + for (Date d : getDeletedInstanceDates()) result += "\n " + d.toString(); result += "\n " + getModifiedInstanceDates().length + " modified"; int excount = 0; for (Date d : getModifiedInstanceDates()) { result += "\n " + d.toString(); - result += "\n"+ getException(excount++); + result += "\n" + getException(excount++); } - result+="\n"; + result += "\n"; return result; } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java index 7dd4172e..367b0741 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTAttachment.java @@ -57,8 +57,11 @@ public class PSTAttachment extends PSTObject { * @param table the table * @param localDescriptorItems the local descriptor items */ - PSTAttachment(final PSTFile theFile, final PSTTableBC table, - final HashMap localDescriptorItems) { + PSTAttachment( + final PSTFile theFile, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, null, table, localDescriptorItems); } @@ -109,9 +112,9 @@ public PSTMessage getEmbeddedPSTMessage() throws IOException, PSTException { final PSTDescriptorItem descriptorItemNested = this.localDescriptorItems.get(descriptorItem); in = new PSTNodeInputStream(this.pstFile, descriptorItemNested); if (descriptorItemNested.subNodeOffsetIndexIdentifier > 0) { - this.localDescriptorItems - .putAll(this.pstFile - .getPSTDescriptorItems(descriptorItemNested.subNodeOffsetIndexIdentifier)); + this.localDescriptorItems.putAll( + this.pstFile.getPSTDescriptorItems(descriptorItemNested.subNodeOffsetIndexIdentifier) + ); } /* * if ( descriptorItemNested != null ) { @@ -120,7 +123,7 @@ public PSTMessage getEmbeddedPSTMessage() throws IOException, PSTException { * blockOffsets = descriptorItemNested.getBlockOffsets(); * } catch (Exception e) { * e.printStackTrace(); - * + * * data = null; * blockOffsets = null; * } @@ -135,8 +138,12 @@ public PSTMessage getEmbeddedPSTMessage() throws IOException, PSTException { try { final PSTTableBC attachmentTable = new PSTTableBC(in); - return PSTObject.createAppropriatePSTMessageObject(this.pstFile, this.descriptorIndexNode, - attachmentTable, this.localDescriptorItems); + return PSTObject.createAppropriatePSTMessageObject( + this.pstFile, + this.descriptorIndexNode, + attachmentTable, + this.localDescriptorItems + ); } catch (final PSTException e) { e.printStackTrace(); } @@ -153,20 +160,18 @@ public PSTMessage getEmbeddedPSTMessage() throws IOException, PSTException { * @throws PSTException the pst exception */ public InputStream getFileInputStream() throws IOException, PSTException { - final PSTTableBCItem attachmentDataObject = this.items.get(0x3701); if (null == attachmentDataObject) { return new ByteArrayInputStream(new byte[0]); } else if (attachmentDataObject.isExternalValueReference) { - final PSTDescriptorItem descriptorItemNested = this.localDescriptorItems - .get(attachmentDataObject.entryValueReference); + final PSTDescriptorItem descriptorItemNested = + this.localDescriptorItems.get(attachmentDataObject.entryValueReference); return new PSTNodeInputStream(this.pstFile, descriptorItemNested); } else { // internal value references are never encrypted return new PSTNodeInputStream(this.pstFile, attachmentDataObject.data, false); } - } /** @@ -179,18 +184,18 @@ public InputStream getFileInputStream() throws IOException, PSTException { public int getFilesize() throws PSTException, IOException { final PSTTableBCItem attachmentDataObject = this.items.get(0x3701); if (attachmentDataObject.isExternalValueReference) { - final PSTDescriptorItem descriptorItemNested = this.localDescriptorItems - .get(attachmentDataObject.entryValueReference); + final PSTDescriptorItem descriptorItemNested = + this.localDescriptorItems.get(attachmentDataObject.entryValueReference); if (descriptorItemNested == null) { throw new PSTException( - "missing attachment descriptor item for: " + attachmentDataObject.entryValueReference); + "missing attachment descriptor item for: " + attachmentDataObject.entryValueReference + ); } return descriptorItemNested.getDataSize(); } else { // raw attachment data, right there! return attachmentDataObject.data.length; } - } // attachment properties @@ -370,7 +375,6 @@ public String getAttachmentContentDisposition() { * @return the boolean */ public boolean isContactPhoto() { - return this.getBooleanItem(0x7FFF,false); + return this.getBooleanItem(0x7FFF, false); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java index 17c018fa..c4dec2cf 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTByteFileContent.java @@ -37,8 +37,6 @@ */ package fr.gouv.vitam.tools.javalibpst; -import java.io.IOException; - public class PSTByteFileContent extends PSTFileContent { protected byte[] content; @@ -81,7 +79,7 @@ public int read(final byte[] target) { return -1; } int targetindex = 0; - while (targetindex < target.length & this.index < this.content.length) { + while ((targetindex < target.length) & (this.index < this.content.length)) { target[targetindex++] = this.content[this.index++]; } return targetindex; @@ -96,5 +94,4 @@ public byte readByte() { public void close() { // Do nothing } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java index 7cd1b0be..4701b2b9 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTContact.java @@ -57,7 +57,7 @@ public class PSTContact extends PSTMessage { * @throws IOException the io exception */ public PSTContact(final PSTFile theFile, final DescriptorIndexNode descriptorIndexNode) - throws PSTException, IOException { + throws PSTException, IOException { super(theFile, descriptorIndexNode); } @@ -69,8 +69,12 @@ public PSTContact(final PSTFile theFile, final DescriptorIndexNode descriptorInd * @param table the table * @param localDescriptorItems the local descriptor items */ - public PSTContact(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + public PSTContact( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -1084,99 +1088,193 @@ public Date getAnniversary() { @Override public String toString() { - - String result = "Name:\n Account name: " + this.getAccount() - + "\n Display Name: " + this.getDisplayName() - + "\n Display Name Prefix (Contact Title): " + this.getDisplayNamePrefix() - + "\n Given name (First name): " + this.getGivenName() - + "\n Middle Name: " + this.getMiddleName() + "\n Surname (Last name): " + this.getSurname() - + "\n Generational abbreviation (name suffix): " + this.getGeneration() - + "\n Initials: " + this.getInitials() - + "\n Original display name: " + this.getOriginalDisplayName() - + "\n Transmittable display name: " + this.getTransmittableDisplayName() - + "\n Nickname: " + this.getNickname() + "\n"; - - result += "Elecronic Addresses:\n SMTP: " + this.getSMTPAddress() - + "\n Email1:\n Address Type: " + this.getEmail1AddressType() - + "\n Original Display Name: " + this.getEmail1OriginalDisplayName() - + "\n Address: " + this.getEmail1EmailAddress() - + "\n Email2:\n Address Type: " + this.getEmail2AddressType() - + "\n Original Display Name: " + this.getEmail2OriginalDisplayName() - + "\n Address: " + this.getEmail2EmailAddress() - + "\n Email3:\n Address Type: " + this.getEmail3AddressType() - + "\n Original Display Name: " + this.getEmail3OriginalDisplayName() - + "\n Address: " + this.getEmail3EmailAddress() + "\n"; - - result += "Business:\n Company Name: " + this.getCompanyName() - + "\n Job title: " + this.getTitle() - + "\n Department name: " + this.getDepartmentName() - + "\n Profession: " + this.getProfession() - + "\n Assistant's Name: " + this.getAssistant() - + "\n Assistant Phone Number: " + this.getAssistantTelephoneNumber() - + "\n Manager's Name: " + this.getManagerName() + "\n"; - - result += "Call numbers:\n Primary Telephone: " + this.getPrimaryTelephoneNumber() - + "\n Business/Office Telephone Number: " + this.getBusinessTelephoneNumber() - + "\n Company Main Phone Number: " + this.getCompanyMainPhoneNumber() - + "\n Home Telephone Number: " + this.getHomeTelephoneNumber() - + "\n Home Telephone Number 2: " + this.getHome2TelephoneNumber() - + "\n Secondary office (business) Telephone number: " + this.getBusiness2TelephoneNumber() - + "\n Mobile Telephone Number: " + this.getMobileTelephoneNumber() - + "\n Callback Telephone Number: " + this.getCallbackTelephoneNumber() - + "\n Radio Telephone Number: " + this.getRadioTelephoneNumber() - + "\n Car Telephone Number: " + this.getCarTelephoneNumber() - + "\n Pager Telephone Number: " + this.getPagerTelephoneNumber() - + "\n Primary Fax Number: " + this.getPrimaryFaxNumber() - + "\n Office (business) fax number: " + this.getBusinessFaxNumber() - + "\n Home fax number: " + this.getHomeFaxNumber() - + "\n Telex Number: " + this.getTelexNumber() - + "\n ISDN Number: " + this.getIsdnNumber() - + "\n TTY/TDD Phone: " + this.getTtytddPhoneNumber() - + "\n Other Telephone Number: " + this.getOtherTelephoneNumber() + "\n"; - - result += "Addresses:\n Default: " + this.getPostalAddress() - + "\n Business:" - + "\n Office location: " + this.getOfficeLocation() - + "\n Business Address Street: " + this.getBusinessAddressStreet() - + "\n Business Postal Code: " + this.getBusinessPostalCode() - + "\n Business Address City: " + this.getBusinessAddressCity() - + "\n Business Address State: " + this.getBusinessAddressStateOrProvince() - + "\n Business Address Country: " + this.getBusinessAddressCountry() - + "\n Business PO Box: " + this.getBusinessPoBox() - + "\n Home:" - + "\n Location: " + this.getLocation() - + "\n Home Address Street: " + this.getHomeAddressStreet() - + "\n Home Postal Code: " + this.getHomeAddressPostalCode() - + "\n Home Address City: " + this.getHomeAddressCity() - + "\n Home Address State: " + this.getHomeAddressStateOrProvince() - + "\n Home Address Country: " + this.getHomeAddressCountry() - + "\n Home PO Box: " + this.getHomeAddressPostOfficeBox() - + "\n Other:" - + "\n Other Address Street: " + this.getOtherAddressStreet() - + "\n Other Postal Code: " + this.getOtherAddressPostalCode() - + "\n Other Address City: " + this.getOtherAddressCity() - + "\n Other Address State: " + this.getOtherAddressStateOrProvince() - + "\n Other Address Country: " + this.getOtherAddressCountry() - + "\n Other PO Box: " + this.getOtherAddressPostOfficeBox() + "\n"; - - result += "IDs:\n Government ID Number: " + this.getGovernmentIdNumber() - + "\n Organizational ID number: " + this.getOrganizationalIdNumber() - + "\n Customer ID: " + this.getCustomerId() + "\n"; - - result += "Misc\n Keyword: " + this.getKeyword() - + "\n Contact's language: " + this.getLanguage() - + "\n MHS Common Name: " + this.getMhsCommonName() - + "\n Hobbies: " + this.getHobbies() - + "\n Preferred By Name: " + this.getPreferredByName() - + "\n Spouse's Name: " + this.getSpouseName() - + "\n Childrens names: " + this.getChildrensNames() - + "\n Computer Network Name: " + this.getComputerNetworkName() - + "\n Ftp Site: " + this.getFtpSite() - + "\n Personal Home Page: " + this.getPersonalHomePage() - + "\n Business Home Page: " + this.getBusinessHomePage() + "\n"; - - if ((this.getBody() != null) && !(this.getBody().isEmpty())) - result += "Body:\n" + this.getBody(); + String result = + "Name:\n Account name: " + + this.getAccount() + + "\n Display Name: " + + this.getDisplayName() + + "\n Display Name Prefix (Contact Title): " + + this.getDisplayNamePrefix() + + "\n Given name (First name): " + + this.getGivenName() + + "\n Middle Name: " + + this.getMiddleName() + + "\n Surname (Last name): " + + this.getSurname() + + "\n Generational abbreviation (name suffix): " + + this.getGeneration() + + "\n Initials: " + + this.getInitials() + + "\n Original display name: " + + this.getOriginalDisplayName() + + "\n Transmittable display name: " + + this.getTransmittableDisplayName() + + "\n Nickname: " + + this.getNickname() + + "\n"; + + result += + "Elecronic Addresses:\n SMTP: " + + this.getSMTPAddress() + + "\n Email1:\n Address Type: " + + this.getEmail1AddressType() + + "\n Original Display Name: " + + this.getEmail1OriginalDisplayName() + + "\n Address: " + + this.getEmail1EmailAddress() + + "\n Email2:\n Address Type: " + + this.getEmail2AddressType() + + "\n Original Display Name: " + + this.getEmail2OriginalDisplayName() + + "\n Address: " + + this.getEmail2EmailAddress() + + "\n Email3:\n Address Type: " + + this.getEmail3AddressType() + + "\n Original Display Name: " + + this.getEmail3OriginalDisplayName() + + "\n Address: " + + this.getEmail3EmailAddress() + + "\n"; + + result += + "Business:\n Company Name: " + + this.getCompanyName() + + "\n Job title: " + + this.getTitle() + + "\n Department name: " + + this.getDepartmentName() + + "\n Profession: " + + this.getProfession() + + "\n Assistant's Name: " + + this.getAssistant() + + "\n Assistant Phone Number: " + + this.getAssistantTelephoneNumber() + + "\n Manager's Name: " + + this.getManagerName() + + "\n"; + + result += + "Call numbers:\n Primary Telephone: " + + this.getPrimaryTelephoneNumber() + + "\n Business/Office Telephone Number: " + + this.getBusinessTelephoneNumber() + + "\n Company Main Phone Number: " + + this.getCompanyMainPhoneNumber() + + "\n Home Telephone Number: " + + this.getHomeTelephoneNumber() + + "\n Home Telephone Number 2: " + + this.getHome2TelephoneNumber() + + "\n Secondary office (business) Telephone number: " + + this.getBusiness2TelephoneNumber() + + "\n Mobile Telephone Number: " + + this.getMobileTelephoneNumber() + + "\n Callback Telephone Number: " + + this.getCallbackTelephoneNumber() + + "\n Radio Telephone Number: " + + this.getRadioTelephoneNumber() + + "\n Car Telephone Number: " + + this.getCarTelephoneNumber() + + "\n Pager Telephone Number: " + + this.getPagerTelephoneNumber() + + "\n Primary Fax Number: " + + this.getPrimaryFaxNumber() + + "\n Office (business) fax number: " + + this.getBusinessFaxNumber() + + "\n Home fax number: " + + this.getHomeFaxNumber() + + "\n Telex Number: " + + this.getTelexNumber() + + "\n ISDN Number: " + + this.getIsdnNumber() + + "\n TTY/TDD Phone: " + + this.getTtytddPhoneNumber() + + "\n Other Telephone Number: " + + this.getOtherTelephoneNumber() + + "\n"; + + result += + "Addresses:\n Default: " + + this.getPostalAddress() + + "\n Business:" + + "\n Office location: " + + this.getOfficeLocation() + + "\n Business Address Street: " + + this.getBusinessAddressStreet() + + "\n Business Postal Code: " + + this.getBusinessPostalCode() + + "\n Business Address City: " + + this.getBusinessAddressCity() + + "\n Business Address State: " + + this.getBusinessAddressStateOrProvince() + + "\n Business Address Country: " + + this.getBusinessAddressCountry() + + "\n Business PO Box: " + + this.getBusinessPoBox() + + "\n Home:" + + "\n Location: " + + this.getLocation() + + "\n Home Address Street: " + + this.getHomeAddressStreet() + + "\n Home Postal Code: " + + this.getHomeAddressPostalCode() + + "\n Home Address City: " + + this.getHomeAddressCity() + + "\n Home Address State: " + + this.getHomeAddressStateOrProvince() + + "\n Home Address Country: " + + this.getHomeAddressCountry() + + "\n Home PO Box: " + + this.getHomeAddressPostOfficeBox() + + "\n Other:" + + "\n Other Address Street: " + + this.getOtherAddressStreet() + + "\n Other Postal Code: " + + this.getOtherAddressPostalCode() + + "\n Other Address City: " + + this.getOtherAddressCity() + + "\n Other Address State: " + + this.getOtherAddressStateOrProvince() + + "\n Other Address Country: " + + this.getOtherAddressCountry() + + "\n Other PO Box: " + + this.getOtherAddressPostOfficeBox() + + "\n"; + + result += + "IDs:\n Government ID Number: " + + this.getGovernmentIdNumber() + + "\n Organizational ID number: " + + this.getOrganizationalIdNumber() + + "\n Customer ID: " + + this.getCustomerId() + + "\n"; + + result += + "Misc\n Keyword: " + + this.getKeyword() + + "\n Contact's language: " + + this.getLanguage() + + "\n MHS Common Name: " + + this.getMhsCommonName() + + "\n Hobbies: " + + this.getHobbies() + + "\n Preferred By Name: " + + this.getPreferredByName() + + "\n Spouse's Name: " + + this.getSpouseName() + + "\n Childrens names: " + + this.getChildrensNames() + + "\n Computer Network Name: " + + this.getComputerNetworkName() + + "\n Ftp Site: " + + this.getFtpSite() + + "\n Personal Home Page: " + + this.getPersonalHomePage() + + "\n Business Home Page: " + + this.getBusinessHomePage() + + "\n"; + + if ((this.getBody() != null) && !(this.getBody().isEmpty())) result += "Body:\n" + this.getBody(); return result; } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java index 05ca6d3e..4bf383cb 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTConversationIndex.java @@ -48,6 +48,7 @@ * @author Nick Buller */ public class PSTConversationIndex { + private static final int HUNDRED_NS_TO_MS = 1000; private static final int MINIMUM_HEADER_SIZE = 22; private static final int RESPONSE_LEVEL_SIZE = 5; @@ -74,6 +75,7 @@ public String toString() { } public class ResponseLevel { + short deltaCode; long timeDelta; short random; @@ -130,10 +132,16 @@ private void decodeResponseLevel(final byte[] rawConversationIndex) { final int responseLevelCount = (rawConversationIndex.length - MINIMUM_HEADER_SIZE) / RESPONSE_LEVEL_SIZE; this.responseLevels = new ArrayList<>(responseLevelCount); - for (int responseLevelIndex = 0, position = 22; responseLevelIndex < responseLevelCount; responseLevelIndex++, position += RESPONSE_LEVEL_SIZE) { - - final long responseLevelValue = PSTObject.convertBigEndianBytesToLong(rawConversationIndex, position, - position + 5); + for ( + int responseLevelIndex = 0, position = 22; + responseLevelIndex < responseLevelCount; + responseLevelIndex++, position += RESPONSE_LEVEL_SIZE + ) { + final long responseLevelValue = PSTObject.convertBigEndianBytesToLong( + rawConversationIndex, + position, + position + 5 + ); final short deltaCode = (short) (responseLevelValue >> 39); final short random = (short) (responseLevelValue & 0xFF); diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java index b902ac34..3f477691 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDescriptorItem.java @@ -50,27 +50,32 @@ * @author Richard Johnson */ class PSTDescriptorItem { + PSTDescriptorItem(final byte[] data, final int offset, final PSTFile pstFile, int entryType) { this.pstFile = pstFile; if (pstFile.getPSTFileType() == PSTFile.PST_TYPE_ANSI) { this.descriptorIdentifier = (int) PSTObject.convertLittleEndianBytesToLong(data, offset, offset + 4); - this.offsetIndexIdentifier = ((int) PSTObject.convertLittleEndianBytesToLong(data, offset + 4, offset + 8)) - & 0xfffffffe; - if (entryType == PSTFile.SLBLOCK_ENTRY) - this.subNodeOffsetIndexIdentifier = (int) PSTObject.convertLittleEndianBytesToLong(data, offset + 8, - offset + 12) & 0xfffffffe; - else - this.subNodeOffsetIndexIdentifier = 0; + this.offsetIndexIdentifier = ((int) PSTObject.convertLittleEndianBytesToLong( + data, + offset + 4, + offset + 8 + )) & + 0xfffffffe; + if (entryType == PSTFile.SLBLOCK_ENTRY) this.subNodeOffsetIndexIdentifier = + (int) PSTObject.convertLittleEndianBytesToLong(data, offset + 8, offset + 12) & 0xfffffffe; + else this.subNodeOffsetIndexIdentifier = 0; } else { this.descriptorIdentifier = (int) PSTObject.convertLittleEndianBytesToLong(data, offset, offset + 4); - this.offsetIndexIdentifier = ((int) PSTObject.convertLittleEndianBytesToLong(data, offset + 8, offset + 16)) - & 0xfffffffe; - if (entryType == PSTFile.SLBLOCK_ENTRY) - this.subNodeOffsetIndexIdentifier = (int) PSTObject.convertLittleEndianBytesToLong(data, offset + 16, - offset + 24) & 0xfffffffe; - else - this.subNodeOffsetIndexIdentifier = 0; + this.offsetIndexIdentifier = ((int) PSTObject.convertLittleEndianBytesToLong( + data, + offset + 8, + offset + 16 + )) & + 0xfffffffe; + if (entryType == PSTFile.SLBLOCK_ENTRY) this.subNodeOffsetIndexIdentifier = + (int) PSTObject.convertLittleEndianBytesToLong(data, offset + 16, offset + 24) & 0xfffffffe; + else this.subNodeOffsetIndexIdentifier = 0; } } @@ -88,7 +93,6 @@ public byte[] getData() throws IOException, PSTException { public int[] getBlockOffsets() throws IOException, PSTException { if (this.dataBlockOffsets != null) { - return this.dataBlockOffsets; } final Long[] offsets = this.pstFile.readLeaf(this.offsetIndexIdentifier).getBlockOffsets(); @@ -116,10 +120,17 @@ public int getDataSize() throws IOException, PSTException { @Override public String toString() { - return "PSTDescriptorItem\n" + " descriptorIdentifier: " + this.descriptorIdentifier + "\n" - + " offsetIndexIdentifier: " + this.offsetIndexIdentifier + "\n" + " subNodeOffsetIndexIdentifier: " - + this.subNodeOffsetIndexIdentifier + "\n"; - + return ( + "PSTDescriptorItem\n" + + " descriptorIdentifier: " + + this.descriptorIdentifier + + "\n" + + " offsetIndexIdentifier: " + + this.offsetIndexIdentifier + + "\n" + + " subNodeOffsetIndexIdentifier: " + + this.subNodeOffsetIndexIdentifier + + "\n" + ); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java index 988ef25a..aecc8f69 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTDistList.java @@ -43,14 +43,14 @@ /** * PST DistList for extracting Addresses from Distribution lists. - * + * * @author Richard Johnson */ public class PSTDistList extends PSTMessage { /** * constructor. - * + * * @param theFile * pst file * @param descriptorIndexNode @@ -66,7 +66,7 @@ public class PSTDistList extends PSTMessage { /** * Internal constructor for performance. - * + * * @param theFile * pst file * @param folderIndexNode @@ -77,14 +77,18 @@ public class PSTDistList extends PSTMessage { * additional external items that represent * this object. */ - PSTDistList(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + PSTDistList( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } /** * Find the next two null bytes in an array given start. - * + * * @param data * the array to search * @param start @@ -103,21 +107,52 @@ private int findNextNullChar(final byte[] data, int start) { /** * identifier for one-off entries. */ - private final byte[] oneOffEntryIdUid = { (byte) 0x81, (byte) 0x2b, (byte) 0x1f, (byte) 0xa4, (byte) 0xbe, - (byte) 0xa3, (byte) 0x10, (byte) 0x19, (byte) 0x9d, (byte) 0x6e, (byte) 0x00, (byte) 0xdd, (byte) 0x01, - (byte) 0x0f, (byte) 0x54, (byte) 0x02 }; + private final byte[] oneOffEntryIdUid = { + (byte) 0x81, + (byte) 0x2b, + (byte) 0x1f, + (byte) 0xa4, + (byte) 0xbe, + (byte) 0xa3, + (byte) 0x10, + (byte) 0x19, + (byte) 0x9d, + (byte) 0x6e, + (byte) 0x00, + (byte) 0xdd, + (byte) 0x01, + (byte) 0x0f, + (byte) 0x54, + (byte) 0x02, + }; /** * identifier for wrapped entries. */ - private final byte[] wrappedEntryIdUid = { (byte) 0xc0, (byte) 0x91, (byte) 0xad, (byte) 0xd3, (byte) 0x51, - (byte) 0x9d, (byte) 0xcf, (byte) 0x11, (byte) 0xa4, (byte) 0xa9, (byte) 0x00, (byte) 0xaa, (byte) 0x00, - (byte) 0x47, (byte) 0xfa, (byte) 0xa4 }; + private final byte[] wrappedEntryIdUid = { + (byte) 0xc0, + (byte) 0x91, + (byte) 0xad, + (byte) 0xd3, + (byte) 0x51, + (byte) 0x9d, + (byte) 0xcf, + (byte) 0x11, + (byte) 0xa4, + (byte) 0xa9, + (byte) 0x00, + (byte) 0xaa, + (byte) 0x00, + (byte) 0x47, + (byte) 0xfa, + (byte) 0xa4, + }; /** * Inner class to represent distribution list one-off entries. */ public class OneOffEntry { + /** display name. */ private String displayName = ""; @@ -156,14 +191,18 @@ public String getEmailAddress() { */ @Override public String toString() { - return String.format("Display Name: %s\n" + "Address Type: %s\n" + "Email Address: %s\n", this.displayName, - this.addressType, this.emailAddress); + return String.format( + "Display Name: %s\n" + "Address Type: %s\n" + "Email Address: %s\n", + this.displayName, + this.addressType, + this.emailAddress + ); } } /** * Parse a one-off entry from this Distribution List. - * + * * @param data * the item data * @param pos @@ -217,7 +256,7 @@ private OneOffEntry parseOneOffEntry(final byte[] data, int pos) throws IOExcept /** * Get an array of the members in this distribution list. - * + * * @throws PSTException * on corrupted data * @throws IOException @@ -248,7 +287,7 @@ public Object[] getDistributionListMembers() throws PSTException, IOException { if (Arrays.equals(guid, this.wrappedEntryIdUid)) { /* c3 */ final int entryType = item.data[pos] & 0x0F; - final int entryAddressType = item.data[pos] & 0x70 >> 4; + final int entryAddressType = item.data[pos] & (0x70 >> 4); final boolean isOneOffEntryId = (item.data[pos] & 0x80) > 0; pos++; final int wrappedflags = (int) PSTObject.convertLittleEndianBytesToLong(item.data, pos, pos + 4); @@ -265,7 +304,6 @@ public Object[] getDistributionListMembers() throws PSTException, IOException { pos++; out[x] = PSTObject.detectAndLoadPSTObject(this.pstFile, descriptorIndex); - } else if (Arrays.equals(guid, this.oneOffEntryIdUid)) { final OneOffEntry entry = this.parseOneOffEntry(item.data, pos); pos = entry.pos; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java index 75e13d85..694abd32 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTException.java @@ -39,10 +39,11 @@ /** * Simple exception for PST File related errors - * + * * @author Richard Johnson */ public class PSTException extends Exception { + /** * eclipse generated serial UID */ diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java index b014b4a2..b3404333 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFile.java @@ -82,21 +82,22 @@ public class PSTFile { // Now the string guids private static final String guidStrings[] = { - "00020329-0000-0000-C000-000000000046", - "00062008-0000-0000-C000-000000000046", - "00062004-0000-0000-C000-000000000046", - "00020386-0000-0000-C000-000000000046", - "00062002-0000-0000-C000-000000000046", - "6ED8DA90-450B-101B-98DA-00AA003F1305", - "0006200A-0000-0000-C000-000000000046", - "41F28F13-83F4-4114-A584-EEDB5A6B0BFF", - "0006200E-0000-0000-C000-000000000046", - "00062041-0000-0000-C000-000000000046", - "00062003-0000-0000-C000-000000000046", - "4442858E-A9E3-4E80-B900-317A210CC15B", - "00020328-0000-0000-C000-000000000046", - "71035549-0739-4DCB-9163-00F0580DBBDF", - "00062040-0000-0000-C000-000000000046"}; + "00020329-0000-0000-C000-000000000046", + "00062008-0000-0000-C000-000000000046", + "00062004-0000-0000-C000-000000000046", + "00020386-0000-0000-C000-000000000046", + "00062002-0000-0000-C000-000000000046", + "6ED8DA90-450B-101B-98DA-00AA003F1305", + "0006200A-0000-0000-C000-000000000046", + "41F28F13-83F4-4114-A584-EEDB5A6B0BFF", + "0006200E-0000-0000-C000-000000000046", + "00062041-0000-0000-C000-000000000046", + "00062003-0000-0000-C000-000000000046", + "4442858E-A9E3-4E80-B900-317A210CC15B", + "00020328-0000-0000-C000-000000000046", + "71035549-0739-4DCB-9163-00F0580DBBDF", + "00062040-0000-0000-C000-000000000046", + }; private final HashMap guidMap = new HashMap<>(); @@ -161,10 +162,11 @@ public PSTFile(final byte[] bytes) throws FileNotFoundException, PSTException, I * @throws IOException the io exception */ public PSTFile(final PSTFileContent content) throws FileNotFoundException, PSTException, IOException { - this(content, false); + this(content, false); } - private PSTFile(final PSTFileContent content, boolean closeFileContant) throws FileNotFoundException, PSTException, IOException { + private PSTFile(final PSTFileContent content, boolean closeFileContant) + throws FileNotFoundException, PSTException, IOException { // attempt to open the file. this.in = content; @@ -187,8 +189,11 @@ private PSTFile(final PSTFileContent content, boolean closeFileContant) throws if (fileTypeBytes[0] == PSTFile.PST_TYPE_ANSI_2) { fileTypeBytes[0] = PSTFile.PST_TYPE_ANSI; } - if (fileTypeBytes[0] != PSTFile.PST_TYPE_ANSI && fileTypeBytes[0] != PSTFile.PST_TYPE_UNICODE - && fileTypeBytes[0] != PSTFile.PST_TYPE_2013_UNICODE) { + if ( + fileTypeBytes[0] != PSTFile.PST_TYPE_ANSI && + fileTypeBytes[0] != PSTFile.PST_TYPE_UNICODE && + fileTypeBytes[0] != PSTFile.PST_TYPE_2013_UNICODE + ) { throw new PSTException("Unrecognised PST File version: " + fileTypeBytes[0]); } this.pstFileType = fileTypeBytes[0]; @@ -210,13 +215,10 @@ private PSTFile(final PSTFileContent content, boolean closeFileContant) throws // get the default codepage globalCodepage = inferGlobalCodepage(); } catch (final IOException err) { - if (closeFileContant) - this.in.close(); + if (closeFileContant) this.in.close(); throw new PSTException("Unable to read PST Sig", err); - } - catch (Exception overException) { - if (closeFileContant) - this.in.close(); + } catch (Exception overException) { + if (closeFileContant) this.in.close(); throw overException; } } @@ -231,8 +233,7 @@ private String inferGlobalCodepage() { } catch (PSTException | IOException e) { return null; } - if (codepageIdentifier != 0) - return getInternetCodePageCharset(codepageIdentifier); + if (codepageIdentifier != 0) return getInternetCodePageCharset(codepageIdentifier); return Charset.defaultCharset().name(); } @@ -258,7 +259,6 @@ public int getPSTFileType() { * @throws PSTException PSTException */ private void processNameToIdMap(final PSTFileContent in) throws IOException, PSTException { - // Create our guid map for (int i = 0; i < guidStrings.length; ++i) { final UUID uuid = UUID.fromString(guidStrings[i]); @@ -279,8 +279,9 @@ private void processNameToIdMap(final PSTFileContent in) throws IOException, PST // PSTDescriptor descriptor = new PSTDescriptor(this, // nameToIdMapDescriptorNode.localDescriptorsOffsetIndexIdentifier); // localDescriptorItems = descriptor.getChildren(); - localDescriptorItems = this - .getPSTDescriptorItems(nameToIdMapDescriptorNode.localDescriptorsOffsetIndexIdentifier); + localDescriptorItems = this.getPSTDescriptorItems( + nameToIdMapDescriptorNode.localDescriptorsOffsetIndexIdentifier + ); } // process the map @@ -302,9 +303,10 @@ private void processNameToIdMap(final PSTFileContent in) throws IOException, PST final int[] uuidIndexes = new int[nGuids]; int offset = 0; for (int i = 0; i < nGuids; ++i) { - final long mostSigBits = (PSTObject.convertLittleEndianBytesToLong(this.guids, offset, offset + 4) << 32) - | (PSTObject.convertLittleEndianBytesToLong(this.guids, offset + 4, offset + 6) << 16) - | PSTObject.convertLittleEndianBytesToLong(this.guids, offset + 6, offset + 8); + final long mostSigBits = + (PSTObject.convertLittleEndianBytesToLong(this.guids, offset, offset + 4) << 32) | + (PSTObject.convertLittleEndianBytesToLong(this.guids, offset + 4, offset + 6) << 16) | + PSTObject.convertLittleEndianBytesToLong(this.guids, offset + 6, offset + 8); final long leastSigBits = PSTObject.convertBigEndianBytesToLong(this.guids, offset + 8, offset + 16); uuidArray[i] = new UUID(mostSigBits, leastSigBits); if (this.guidMap.containsKey(uuidArray[i])) { @@ -355,8 +357,11 @@ private void processNameToIdMap(final PSTFileContent in) throws IOException, PST // else the identifier is a string // dwPropertyId becomes thHke byte offset into the String stream // in which the string name of the property is stored. - final int len = (int) PSTObject.convertLittleEndianBytesToLong(stringNameToIdByte, dwPropertyId, - dwPropertyId + 4); + final int len = (int) PSTObject.convertLittleEndianBytesToLong( + stringNameToIdByte, + dwPropertyId, + dwPropertyId + 4 + ); if (len > 0 && len < stringNameToIdByte.length) { final byte[] keyByteValue = new byte[len]; System.arraycopy(stringNameToIdByte, dwPropertyId + 4, keyByteValue, 0, keyByteValue.length); @@ -370,7 +375,7 @@ private void processNameToIdMap(final PSTFileContent in) throws IOException, PST } private byte[] getData(final PSTTableItem item, final HashMap localDescriptorItems) - throws IOException, PSTException { + throws IOException, PSTException { if (item.data.length != 0) { return item.data; } @@ -407,9 +412,7 @@ int getPublicStringToIdMapItem(final String key) { return i; } - static long getNameToIdMapKey(final int id) - // throws PSTException - { + static long getNameToIdMapKey(final int id) { // throws PSTException final Long i = idToName.get(id); if (i == null) { // throw new PSTException("Name to Id mapping not found"); @@ -418,8 +421,8 @@ static long getNameToIdMapKey(final int id) return i; } - static private Properties propertyInternetCodePages = null; - static private boolean bCPFirstTime = true; + private static Properties propertyInternetCodePages = null; + private static boolean bCPFirstTime = true; static String getInternetCodePageCharset(final int propertyId) { if (bCPFirstTime) { @@ -446,8 +449,8 @@ static String getInternetCodePageCharset(final int propertyId) { return null; } - static private Properties propertyNames = null; - static private boolean bFirstTime = true; + private static Properties propertyNames = null; + private static boolean bFirstTime = true; static String getPropertyName(final int propertyId, final boolean bNamed) { if (bFirstTime) { @@ -558,8 +561,8 @@ public PSTFileContent getContentHandle() { * @throws IOException the io exception */ public PSTMessageStore getMessageStore() throws PSTException, IOException { - final DescriptorIndexNode messageStoreDescriptor = this - .getDescriptorIndexNode(MESSAGE_STORE_DESCRIPTOR_IDENTIFIER); + final DescriptorIndexNode messageStoreDescriptor = + this.getDescriptorIndexNode(MESSAGE_STORE_DESCRIPTOR_IDENTIFIER); return new PSTMessageStore(this, messageStoreDescriptor); } @@ -584,7 +587,6 @@ PSTNodeInputStream readLeaf(final long bid) throws IOException, PSTException { // get the index node for the descriptor index final OffsetIndexItem offsetItem = this.getOffsetIndexNode(bid); return new PSTNodeInputStream(this, offsetItem); - } /** @@ -665,8 +667,7 @@ private long extractLEFileOffset(final long startOffset) throws IOException { * @throws PSTException the pst exception */ private byte[] findBtreeItem(final PSTFileContent in, final long index, final boolean descTree) - throws IOException, PSTException { - + throws IOException, PSTException { synchronized (in) { long btreeStartOffset; int fileTypeAdjustment; @@ -697,8 +698,10 @@ private byte[] findBtreeItem(final PSTFileContent in, final long index, final bo in.seek(btreeStartOffset + fileTypeAdjustment); in.readCompletely(temp); - while ((temp[0] == 0xffffff80 && temp[1] == 0xffffff80 && !descTree) - || (temp[0] == 0xffffff81 && temp[1] == 0xffffff81 && descTree)) { + while ( + (temp[0] == 0xffffff80 && temp[1] == 0xffffff80 && !descTree) || + (temp[0] == 0xffffff81 && temp[1] == 0xffffff81 && descTree) + ) { // get the rest of the data.... byte[] branchNodeItems; if (this.getPSTFileType() == PST_TYPE_ANSI) { @@ -755,11 +758,15 @@ private byte[] findBtreeItem(final PSTFileContent in, final long index, final bo if (!found) { // it must be in the very last branch... if (this.getPSTFileType() == PST_TYPE_ANSI) { - btreeStartOffset = this.extractLEFileOffset(btreeStartOffset + ((numberOfItems - 1) * 12) + 8); + btreeStartOffset = this.extractLEFileOffset( + btreeStartOffset + ((numberOfItems - 1) * 12) + 8 + ); in.seek(btreeStartOffset + 500); in.readCompletely(temp); } else { - btreeStartOffset = this.extractLEFileOffset(btreeStartOffset + ((numberOfItems - 1) * 24) + 16); + btreeStartOffset = this.extractLEFileOffset( + btreeStartOffset + ((numberOfItems - 1) * 24) + 16 + ); in.seek(btreeStartOffset + fileTypeAdjustment); in.readCompletely(temp); } @@ -770,7 +777,6 @@ private byte[] findBtreeItem(final PSTFileContent in, final long index, final bo // we are at the bottom of the tree... // we want to get our file offset! for (long x = 0; x < numberOfItems; x++) { - if (this.getPSTFileType() == PSTFile.PST_TYPE_ANSI) { if (descTree) { // The 32-bit descriptor index b-tree leaf node item @@ -786,7 +792,8 @@ private byte[] findBtreeItem(final PSTFileContent in, final long index, final bo } } else { // The 32-bit (file) offset index item - final long indexIdOfFirstChildNode = this.extractLEFileOffset(btreeStartOffset + (x * 12)); + final long indexIdOfFirstChildNode = + this.extractLEFileOffset(btreeStartOffset + (x * 12)); if (indexIdOfFirstChildNode == index) { // we found it!!!! OMG @@ -816,7 +823,8 @@ private byte[] findBtreeItem(final PSTFileContent in, final long index, final bo } } else { // The 64-bit (file) offset index item - final long indexIdOfFirstChildNode = this.extractLEFileOffset(btreeStartOffset + (x * 24)); + final long indexIdOfFirstChildNode = + this.extractLEFileOffset(btreeStartOffset + (x * 24)); if (indexIdOfFirstChildNode == index) { // we found it!!!! OMG @@ -866,7 +874,7 @@ OffsetIndexItem getOffsetIndexNode(final long identifier) throws IOException, PS * parse a PSTDescriptor and get all of its items */ HashMap getPSTDescriptorItems(final long localDescriptorsOffsetIndexIdentifier) - throws PSTException, IOException { + throws PSTException, IOException { return this.getPSTDescriptorItems(this.readLeaf(localDescriptorsOffsetIndexIdentifier)); } @@ -874,7 +882,7 @@ HashMap getPSTDescriptorItems(final long localDescri static final int SIBLOCK_ENTRY = 1; HashMap getPSTDescriptorItems(final PSTNodeInputStream pstNodeInputStream) - throws PSTException, IOException { + throws PSTException, IOException { // make sure the signature is correct pstNodeInputStream.seek(0); final int sig = pstNodeInputStream.read(); @@ -901,20 +909,14 @@ HashMap getPSTDescriptorItems(final PSTNodeInputStre for (int x = 0; x < numberOfItems; x++) { final PSTDescriptorItem item = new PSTDescriptorItem(data, offset, this, blockType); - if (blockType == SLBLOCK_ENTRY) - output.put(item.descriptorIdentifier, item); - else - output.putAll(getPSTDescriptorItems(item.offsetIndexIdentifier)); + if (blockType == SLBLOCK_ENTRY) output.put(item.descriptorIdentifier, item); + else output.putAll(getPSTDescriptorItems(item.offsetIndexIdentifier)); if (this.getPSTFileType() == PSTFile.PST_TYPE_ANSI) { - if (blockType == SLBLOCK_ENTRY) - offset += 12; - else - offset += 8; + if (blockType == SLBLOCK_ENTRY) offset += 12; + else offset += 8; } else { - if (blockType == SLBLOCK_ENTRY) - offset += 24; - else - offset += 16; + if (blockType == SLBLOCK_ENTRY) offset += 24; + else offset += 16; } } return output; @@ -970,7 +972,6 @@ private void processDescriptorBTree(final long btreeStartOffset) throws IOExcept this.in.readCompletely(temp); if ((temp[0] == 0xffffff81 && temp[1] == 0xffffff81)) { - if (this.getPSTFileType() == PST_TYPE_ANSI) { this.in.seek(btreeStartOffset + 496); } else if (this.getPSTFileType() == PST_TYPE_2013_UNICODE) { @@ -1026,8 +1027,8 @@ private void processDescriptorBTree(final long btreeStartOffset) throws IOExcept // skip! } else if (this.childrenDescriptorTree.containsKey(tempNode.parentDescriptorIndexIdentifier)) { // add this entry to the existing list of children - final LinkedList children = this.childrenDescriptorTree - .get(tempNode.parentDescriptorIndexIdentifier); + final LinkedList children = + this.childrenDescriptorTree.get(tempNode.parentDescriptorIndexIdentifier); children.add(tempNode); } else { // create a new entry and add this one to that @@ -1048,13 +1049,13 @@ public void close() throws IOException { this.in.close(); } - static private boolean printErrors=true; + private static boolean printErrors = true; - static public boolean isPrintErrors() { + public static boolean isPrintErrors() { return printErrors; } - static public void setPrintErrors(boolean printErrors) { - PSTFile.printErrors=printErrors; + public static void setPrintErrors(boolean printErrors) { + PSTFile.printErrors = printErrors; } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java index 3a7dd55d..0f390efe 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFileContent.java @@ -38,12 +38,14 @@ package fr.gouv.vitam.tools.javalibpst; import java.io.IOException; + //import java.util.HashMap; //import java.util.concurrent.atomic.AtomicLong; //import java.util.Map; //import java.util.TreeMap; public abstract class PSTFileContent { + public abstract void seek(long index) throws IOException; public abstract long getFilePointer() throws IOException; @@ -53,8 +55,8 @@ public abstract class PSTFileContent { public abstract int read(byte[] target) throws IOException; public final void readCompletely(final byte[] target) throws IOException { - // collectCallStack(); - int read = this.read(target); + // collectCallStack(); + int read = this.read(target); // bail in common case if (read <= 0 || read == target.length) { return; @@ -76,7 +78,6 @@ public final void readCompletely(final byte[] target) throws IOException { public abstract byte readByte() throws IOException; public abstract void close() throws IOException; - /** * Audit the code execution to better understand calls to `seek` and `read` operations * in `PSTFileContent`, and ensure the proper usage of `synchronized(PSTFileContent)` diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java index a65403d2..5fa4a9b8 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTFolder.java @@ -78,8 +78,12 @@ public class PSTFolder extends PSTObject { * @param table the table * @param localDescriptorItems the local descriptor items */ - PSTFolder(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + PSTFolder( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -98,24 +102,35 @@ public Vector getSubFolders() throws PSTException, IOException { final List> itemMapSet = this.subfoldersTable.getItems(); for (final HashMap itemMap : itemMapSet) { final PSTTable7CItem item = itemMap.get(26610); - final PSTFolder folder = (PSTFolder) PSTObject.detectAndLoadPSTObject(this.pstFile, - item.entryValueReference); + final PSTFolder folder = (PSTFolder) PSTObject.detectAndLoadPSTObject( + this.pstFile, + item.entryValueReference + ); output.add(folder); } } catch (final PSTException err) { // hierarchy node doesn't exist: This is OK if child count is 0. - // Seen with special search folders at the top of the hierarchy: - // "8739 - SPAM Search Folder 2", "8739 - Content.Filter". - // this.subfoldersTable may remain uninitialized (null) in that case. - if (this.getContentCount() != 0) { - if (err.getMessage().startsWith("Can't get child folders")) { - throw err; - } else { - //err.printStackTrace(); - throw new PSTException("Can't get child folders for folder " + this.getDisplayName() + "(" - + this.getDescriptorNodeId() + ") child count: " + this.getContentCount() + " - " + err.toString(), err); - } - } + // Seen with special search folders at the top of the hierarchy: + // "8739 - SPAM Search Folder 2", "8739 - Content.Filter". + // this.subfoldersTable may remain uninitialized (null) in that case. + if (this.getContentCount() != 0) { + if (err.getMessage().startsWith("Can't get child folders")) { + throw err; + } else { + //err.printStackTrace(); + throw new PSTException( + "Can't get child folders for folder " + + this.getDisplayName() + + "(" + + this.getDescriptorNodeId() + + ") child count: " + + this.getContentCount() + + " - " + + err.toString(), + err + ); + } + } } return output; } @@ -134,12 +149,26 @@ private void initSubfoldersTable() throws IOException, PSTException { // folderDescriptor.localDescriptorsOffsetIndexIdentifier).getChildren(); tmp = this.pstFile.getPSTDescriptorItems(folderDescriptor.localDescriptorsOffsetIndexIdentifier); } - this.subfoldersTable = new PSTTable7C(new PSTNodeInputStream(this.pstFile, - this.pstFile.getOffsetIndexNode(folderDescriptor.dataOffsetIndexIdentifier)), tmp); + this.subfoldersTable = new PSTTable7C( + new PSTNodeInputStream( + this.pstFile, + this.pstFile.getOffsetIndexNode(folderDescriptor.dataOffsetIndexIdentifier) + ), + tmp + ); } catch (final PSTException err) { // hierarchy node doesn't exist - throw new PSTException("Can't get child folders for folder " + this.getDisplayName() + "(" - + this.getDescriptorNodeId() + ") child count: " + this.getContentCount() + " - " + err.toString(), err); + throw new PSTException( + "Can't get child folders for folder " + + this.getDisplayName() + + "(" + + this.getDescriptorNodeId() + + ") child count: " + + this.getContentCount() + + " - " + + err.toString(), + err + ); } } @@ -156,7 +185,7 @@ private void initSubfoldersTable() throws IOException, PSTException { /** * this method goes through all of the children and sorts them into one of * the three hash sets. - * + * * @throws PSTException the pst exception * @throws IOException the io exception */ @@ -172,9 +201,9 @@ private void initEmailsTable() throws PSTException, IOException { try { final long folderDescriptorIndex = this.descriptorIndexNode.descriptorIdentifier + 12; // +12 - // lists - // emails! - // :D + // lists + // emails! + // :D final DescriptorIndexNode folderDescriptor = this.pstFile.getDescriptorIndexNode(folderDescriptorIndex); HashMap tmp = null; if (folderDescriptor.localDescriptorsOffsetIndexIdentifier > 0) { @@ -185,10 +214,15 @@ private void initEmailsTable() throws PSTException, IOException { // PSTTable7CForFolder folderDescriptorTable = new // PSTTable7CForFolder(folderDescriptor.dataBlock.data, // folderDescriptor.dataBlock.blockOffsets,tmp, 0x67F2); - this.emailsTable = new PSTTable7C(new PSTNodeInputStream(this.pstFile, - this.pstFile.getOffsetIndexNode(folderDescriptor.dataOffsetIndexIdentifier)), tmp, 0x67F2); + this.emailsTable = new PSTTable7C( + new PSTNodeInputStream( + this.pstFile, + this.pstFile.getOffsetIndexNode(folderDescriptor.dataOffsetIndexIdentifier) + ), + tmp, + 0x67F2 + ); } catch (final Exception err) { - // here we have to attempt to fallback onto the children as listed // by the descriptor b-tree final LinkedHashMap> tree = this.pstFile.getChildDescriptorTree(); @@ -200,17 +234,28 @@ private void initEmailsTable() throws PSTException, IOException { // quickly go through and remove those entries that are not // messages! for (final DescriptorIndexNode node : allChildren) { - if (node != null - && PSTObject.getNodeType(node.descriptorIdentifier) == PSTObject.NID_TYPE_NORMAL_MESSAGE) { + if ( + node != null && + PSTObject.getNodeType(node.descriptorIdentifier) == PSTObject.NID_TYPE_NORMAL_MESSAGE + ) { this.fallbackEmailsTable.add(node); } } } - if (PSTFile.isPrintErrors()) - System.err.println("Can't get children for folder " + this.getDisplayName() + "(" - + this.getDescriptorNodeId() + ") child count: " + this.getContentCount() + " - " + err.toString() - + ", using alternate child tree with " + this.fallbackEmailsTable.size() + " items"); + if (PSTFile.isPrintErrors()) System.err.println( + "Can't get children for folder " + + this.getDisplayName() + + "(" + + this.getDescriptorNodeId() + + ") child count: " + + this.getContentCount() + + " - " + + err.toString() + + ", using alternate child tree with " + + this.fallbackEmailsTable.size() + + " items" + ); } } @@ -229,8 +274,8 @@ public Vector getChildren(final int numberToReturn) throws PSTExcepti final Vector output = new Vector<>(); if (this.emailsTable != null) { - final List> rows = this.emailsTable.getItems(this.currentEmailIndex, - numberToReturn); + final List> rows = + this.emailsTable.getItems(this.currentEmailIndex, numberToReturn); for (int x = 0; x < rows.size(); x++) { if (this.currentEmailIndex >= this.getContentCount()) { @@ -239,16 +284,16 @@ public Vector getChildren(final int numberToReturn) throws PSTExcepti } // get the emails from the rows final PSTTable7CItem emailRow = rows.get(x).get(0x67F2); - final DescriptorIndexNode childDescriptor = this.pstFile - .getDescriptorIndexNode(emailRow.entryValueReference); + final DescriptorIndexNode childDescriptor = + this.pstFile.getDescriptorIndexNode(emailRow.entryValueReference); final PSTObject child = PSTObject.detectAndLoadPSTObject(this.pstFile, childDescriptor); output.add(child); this.currentEmailIndex++; } } else if (this.fallbackEmailsTable != null) { // we use the fallback - final ListIterator iterator = this.fallbackEmailsTable - .listIterator(this.currentEmailIndex); + final ListIterator iterator = + this.fallbackEmailsTable.listIterator(this.currentEmailIndex); for (int x = 0; x < numberToReturn; x++) { if (this.currentEmailIndex >= this.getContentCount()) { // no more! @@ -315,14 +360,16 @@ public PSTObject getNextChild() throws PSTException, IOException { this.currentEmailIndex++; // get the emails from the rows final PSTTable7CItem emailRow = rows.get(0).get(0x67F2); - final DescriptorIndexNode childDescriptor = this.pstFile - .getDescriptorIndexNode(emailRow.entryValueReference); + final DescriptorIndexNode childDescriptor = + this.pstFile.getDescriptorIndexNode(emailRow.entryValueReference); final PSTObject child = PSTObject.detectAndLoadPSTObject(this.pstFile, childDescriptor); return child; } else if (this.fallbackEmailsTable != null) { - if (this.currentEmailIndex >= this.getContentCount() - || this.currentEmailIndex >= this.fallbackEmailsTable.size()) { + if ( + this.currentEmailIndex >= this.getContentCount() || + this.currentEmailIndex >= this.fallbackEmailsTable.size() + ) { // no more! return null; } @@ -455,6 +502,5 @@ public int getAssociateContentCount() { public int getContainerFlags() { return this.getIntItem(0x3600); } - } // vim: set noexpandtab: diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java index 2567a049..58c5f2f0 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectId.java @@ -54,9 +54,26 @@ * in MS-OXOCAL (not following Java conventions) */ public class PSTGlobalObjectId { - final protected static byte[] ReferenceByteArrayID = { 0x04, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0xe0, 0x00, - 0x74, (byte) 0xc5, (byte) 0xb7, 0x10, 0x1a, (byte) 0x82, (byte) 0xe0, 0x08 }; - final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); + + protected static final byte[] ReferenceByteArrayID = { + 0x04, + 0x00, + 0x00, + 0x00, + (byte) 0x82, + 0x00, + (byte) 0xe0, + 0x00, + 0x74, + (byte) 0xc5, + (byte) 0xb7, + 0x10, + 0x1a, + (byte) 0x82, + (byte) 0xe0, + 0x08, + }; + protected static final char[] hexArray = "0123456789ABCDEF".toCharArray(); byte[] ByteArrayID = new byte[16]; byte YH; @@ -81,9 +98,11 @@ public PSTGlobalObjectId(final byte[] pidData) { throw new AssertionError("ByteArrayID is incorrect"); } - final ByteBuffer buffer = ByteBuffer - .wrap(pidData, ReferenceByteArrayID.length, pidData.length - ReferenceByteArrayID.length) - .order(ByteOrder.LITTLE_ENDIAN); + final ByteBuffer buffer = ByteBuffer.wrap( + pidData, + ReferenceByteArrayID.length, + pidData.length - ReferenceByteArrayID.length + ).order(ByteOrder.LITTLE_ENDIAN); this.YH = buffer.get(); this.YL = buffer.get(); @@ -155,8 +174,30 @@ public byte[] getData() { @Override public String toString() { - return "Byte Array ID[" + bytesToHex(this.ByteArrayID) + "] " + "Year [" + this.getYear() + "] " + "Month[" - + this.M + "] " + "Day[" + this.D + "] CreationTime[" + this.CreationTime + "] " + "X[" + this.X + "] " - + "Size[" + this.Size + "] " + "Data[" + bytesToHex(this.Data) + "]"; + return ( + "Byte Array ID[" + + bytesToHex(this.ByteArrayID) + + "] " + + "Year [" + + this.getYear() + + "] " + + "Month[" + + this.M + + "] " + + "Day[" + + this.D + + "] CreationTime[" + + this.CreationTime + + "] " + + "X[" + + this.X + + "] " + + "Size[" + + this.Size + + "] " + + "Data[" + + bytesToHex(this.Data) + + "]" + ); } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java index 489cfc59..9c3c14a8 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessage.java @@ -88,8 +88,12 @@ public class PSTMessage extends PSTObject { * @param table the table * @param localDescriptorItems the local descriptor items */ - PSTMessage(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + PSTMessage( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -145,9 +149,10 @@ public String getStringBasedOnHexValue(int hexValue) { public int getIntBasedOnHexValue(int hexValue) { return this.getIntItem(hexValue); } + /** * get the message class for the email - * + * * @return empty string if unknown */ @Override @@ -166,12 +171,15 @@ public String getSubject() { // byte[] controlCodesA = {0x01, 0x01}; // byte[] controlCodesB = {0x01, 0x05}; // byte[] controlCodesC = {0x01, 0x10}; - if (subject != null && (subject.length() >= 2) && - - // (subject.startsWith(new String(controlCodesA)) || - // subject.startsWith(new String(controlCodesB)) || - // subject.startsWith(new String(controlCodesC))) - subject.charAt(0) == 0x01) { + if ( + subject != null && + (subject.length() >= 2) && + // (subject.startsWith(new String(controlCodesA)) || + // subject.startsWith(new String(controlCodesB)) || + // subject.startsWith(new String(controlCodesC))) + subject.charAt(0) == + 0x01 + ) { if (subject.length() == 2) { subject = ""; } else { @@ -433,6 +441,7 @@ public int getOriginalSensitivity() { public int getSensitivity() { return this.getIntItem(0x0036); } + // 0x003f 0x0102 PR_RECEIVED_BY_ENTRYID (PidTagReceivedByEntr yId) Received // by entry identifier Binary data Contains recipient/sender structure // 0x0041 0x0102 PR_SENT_REPRESENTING_ENTRYID Sent representing entry @@ -1101,8 +1110,11 @@ public boolean getAttrReadonly() { private void processRecipients() { try { final int recipientTableKey = 0x0692; - if (this.recipientTable == null && this.localDescriptorItems != null - && this.localDescriptorItems.containsKey(recipientTableKey)) { + if ( + this.recipientTable == null && + this.localDescriptorItems != null && + this.localDescriptorItems.containsKey(recipientTableKey) + ) { final PSTDescriptorItem item = this.localDescriptorItems.get(recipientTableKey); HashMap descriptorItems = null; if (item.subNodeOffsetIndexIdentifier > 0) { @@ -1145,14 +1157,17 @@ public int getNumberOfRecipients() throws PSTException, IOException { /** * find, extract and load up all of the attachments in this email * necessary for the other operations. - * + * * @throws PSTException the pst exception * @throws IOException the io exception */ private void processAttachments() throws PSTException, IOException { final int attachmentTableKey = 0x0671; - if (this.attachmentTable == null && this.localDescriptorItems != null - && this.localDescriptorItems.containsKey(attachmentTableKey)) { + if ( + this.attachmentTable == null && + this.localDescriptorItems != null && + this.localDescriptorItems.containsKey(attachmentTableKey) + ) { final PSTDescriptorItem item = this.localDescriptorItems.get(attachmentTableKey); HashMap descriptorItems = null; if (item.subNodeOffsetIndexIdentifier > 0) { @@ -1229,8 +1244,11 @@ public String[] getColorCategories() throws PSTException { categories = new String[categoryCount]; final int[] offsets = new int[categoryCount]; for (int x = 0; x < categoryCount; x++) { - offsets[x] = (int) PSTObject.convertBigEndianBytesToLong(item.data, (x * 4) + 1, - (x + 1) * 4 + 1); + offsets[x] = (int) PSTObject.convertBigEndianBytesToLong( + item.data, + (x * 4) + 1, + (x + 1) * 4 + 1 + ); } for (int x = 0; x < offsets.length - 1; x++) { final int start = offsets[x]; @@ -1293,14 +1311,15 @@ public PSTAttachment getAttachment(final int attachmentNumber) throws PSTExcepti } if (attachmentNumber >= attachmentCount) { - throw new PSTException("unable to fetch attachment number " + attachmentNumber + ", only " + attachmentCount - + " in this email"); + throw new PSTException( + "unable to fetch attachment number " + attachmentNumber + ", only " + attachmentCount + " in this email" + ); } // we process the C7 table here, basically we just want the attachment // local descriptor... - final HashMap attachmentDetails = this.attachmentTable.getItems() - .get(attachmentNumber); + final HashMap attachmentDetails = + this.attachmentTable.getItems().get(attachmentNumber); final PSTTable7CItem attachmentTableItem = attachmentDetails.get(0x67f2); final int descriptorItemId = attachmentTableItem.entryValueReference; @@ -1314,7 +1333,8 @@ public PSTAttachment getAttachment(final int attachmentNumber) throws PSTExcepti // PSTTableBC(descriptorItem.getData(), // descriptorItem.getBlockOffsets()); final PSTTableBC attachmentDetailsTable = new PSTTableBC( - new PSTNodeInputStream(this.pstFile, descriptorItem)); + new PSTNodeInputStream(this.pstFile, descriptorItem) + ); // create our all-precious attachment object. // note that all the information that was in the c7 table is @@ -1322,14 +1342,16 @@ public PSTAttachment getAttachment(final int attachmentNumber) throws PSTExcepti // so no need to pass it... HashMap attachmentDescriptorItems = new HashMap<>(); if (descriptorItem.subNodeOffsetIndexIdentifier > 0) { - attachmentDescriptorItems = this.pstFile - .getPSTDescriptorItems(descriptorItem.subNodeOffsetIndexIdentifier); + attachmentDescriptorItems = this.pstFile.getPSTDescriptorItems( + descriptorItem.subNodeOffsetIndexIdentifier + ); } return new PSTAttachment(this.pstFile, attachmentDetailsTable, attachmentDescriptorItems); } throw new PSTException( - "unable to fetch attachment number " + attachmentNumber + ", unable to read attachment details table"); + "unable to fetch attachment number " + attachmentNumber + ", unable to read attachment details table" + ); } /** @@ -1341,15 +1363,16 @@ public PSTAttachment getAttachment(final int attachmentNumber) throws PSTExcepti * @throws IOException the io exception */ public PSTRecipient getRecipient(final int recipientNumber) throws PSTException, IOException { - if (recipientNumber >= this.getNumberOfRecipients() - || recipientNumber >= this.recipientTable.getItems().size()) { + if ( + recipientNumber >= this.getNumberOfRecipients() || recipientNumber >= this.recipientTable.getItems().size() + ) { throw new PSTException("unable to fetch recipient number " + recipientNumber); } final HashMap recipientDetails = this.recipientTable.getItems().get(recipientNumber); if (recipientDetails != null) { - return new PSTRecipient(this,recipientDetails); + return new PSTRecipient(this, recipientDetails); } return null; @@ -1400,9 +1423,20 @@ public boolean isConversationIndexTracking() { */ @Override public String toString() { - return "PSTEmail: " + this.getSubject() + "\n" + "Importance: " + this.getImportance() + "\n" - + "Message Class: " + this.getMessageClass() + "\n\n" + this.getTransportMessageHeaders() + "\n\n\n" - + this.items + this.localDescriptorItems; + return ( + "PSTEmail: " + + this.getSubject() + + "\n" + + "Importance: " + + this.getImportance() + + "\n" + + "Message Class: " + + this.getMessageClass() + + "\n\n" + + this.getTransportMessageHeaders() + + "\n\n\n" + + this.items + + this.localDescriptorItems + ); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java index 4ab4ad6a..a5936bdf 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTMessageStore.java @@ -43,7 +43,7 @@ /** * Object that represents the message store. * Not much use other than to get the "name" of the PST file. - * + * * @author Richard Johnson */ public class PSTMessageStore extends PSTObject { @@ -65,9 +65,10 @@ public UUID getTagRecordKeyAsUUID() { final PSTTableBCItem item = this.items.get(guidEntryType); final int offset = 0; final byte[] bytes = item.data; - final long mostSigBits = (PSTObject.convertLittleEndianBytesToLong(bytes, offset, offset + 4) << 32) - | (PSTObject.convertLittleEndianBytesToLong(bytes, offset + 4, offset + 6) << 16) - | PSTObject.convertLittleEndianBytesToLong(bytes, offset + 6, offset + 8); + final long mostSigBits = + (PSTObject.convertLittleEndianBytesToLong(bytes, offset, offset + 4) << 32) | + (PSTObject.convertLittleEndianBytesToLong(bytes, offset + 4, offset + 6) << 16) | + PSTObject.convertLittleEndianBytesToLong(bytes, offset + 6, offset + 8); final long leastSigBits = PSTObject.convertBigEndianBytesToLong(bytes, offset + 8, offset + 16); return new UUID(mostSigBits, leastSigBits); } @@ -96,7 +97,7 @@ public String getDetails() { /** * Is this pst file is password protected. - * + * * @throws PSTException * on corrupted pst * @throws IOException @@ -108,5 +109,4 @@ public String getDetails() { public boolean isPasswordProtected() throws PSTException, IOException { return (this.getLongItem(0x67FF) != 0); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java index 5ff1980c..46ca6f6b 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTNodeInputStream.java @@ -41,7 +41,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedList; -import java.util.zip.Inflater; import java.util.zip.InflaterOutputStream; /** @@ -77,7 +76,7 @@ public class PSTNodeInputStream extends InputStream { } PSTNodeInputStream(final PSTFile pstFile, final byte[] attachmentData, final boolean encrypted) - throws PSTException { + throws PSTException { this.in = pstFile.getContentHandle(); this.pstFile = pstFile; this.allData = attachmentData; @@ -217,7 +216,6 @@ private void loadFromOffsetItem(final OffsetIndexItem offsetItem) throws IOExcep } this.allData = data; this.length = this.allData.length; - } public boolean isEncrypted() { @@ -273,7 +271,6 @@ public long length() { @Override public int read() throws IOException { - // first deal with items < 8K and we have all the data already if (this.allData != null) { if (this.currentLocation == this.length) { @@ -370,7 +367,7 @@ public int read(final byte[] output) throws IOException { PSTObject.decode(output); } this.currentLocation += bytesRemaining; // should be = to - // this.length + // this.length return bytesRemaining; } else { System.arraycopy(this.allData, (int) this.currentLocation, output, 0, output.length); @@ -387,7 +384,6 @@ public int read(final byte[] output) throws IOException { // while we still need to fill the array synchronized (in) { while (!filled) { - // fill up the output from where we are // get the current block, either to the end, or until the length of // the output @@ -490,7 +486,8 @@ public void seek(final long location) throws IOException, PSTException { // not past the end! if (location > this.length) { throw new PSTException( - "Unable to seek past end of item! size = " + this.length + ", seeking to:" + location); + "Unable to seek past end of item! size = " + this.length + ", seeking to:" + location + ); } // are we already there? @@ -517,13 +514,12 @@ public void seek(final long location) throws IOException, PSTException { // now move us to the right position in there this.currentLocation = location; - -// Not needed as all PSTNodeInputStream read begin by a PSTFileContent.seek using currentLocation -// if (this.allData == null) { -// long blockStart = this.indexItems.get(this.currentBlock).fileOffset; -// final long newFilePos = blockStart + (location - skipPoint); -// this.in.seek(newFilePos); -// } + // Not needed as all PSTNodeInputStream read begin by a PSTFileContent.seek using currentLocation + // if (this.allData == null) { + // long blockStart = this.indexItems.get(this.currentBlock).fileOffset; + // final long newFilePos = blockStart + (location - skipPoint); + // this.in.seek(newFilePos); + // } } @@ -537,5 +533,4 @@ public long seekAndReadLong(final long location, final int bytes) throws IOExcep public PSTFile getPSTFile() { return this.pstFile; } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java index 1558f2f3..1c80f18b 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTObject.java @@ -62,114 +62,114 @@ public class PSTObject { /** * The constant NID_TYPE_NORMAL_FOLDER. */ -// 2.4.1) + // 2.4.1) public static final int NID_TYPE_NORMAL_FOLDER = 0x02; // Normal Folder /** * The constant NID_TYPE_SEARCH_FOLDER. */ -// object (PC) + // object (PC) public static final int NID_TYPE_SEARCH_FOLDER = 0x03; // Search Folder /** * The constant NID_TYPE_NORMAL_MESSAGE. */ -// object (PC) + // object (PC) public static final int NID_TYPE_NORMAL_MESSAGE = 0x04; // Normal Message /** * The constant NID_TYPE_ATTACHMENT. */ -// object (PC) + // object (PC) public static final int NID_TYPE_ATTACHMENT = 0x05; // Attachment object /** * The constant NID_TYPE_SEARCH_UPDATE_QUEUE. */ -// (PC) + // (PC) public static final int NID_TYPE_SEARCH_UPDATE_QUEUE = 0x06; // Queue of /** * The constant NID_TYPE_SEARCH_CRITERIA_OBJECT. */ -// changed - // objects for - // search - // Folder - // objects + // changed + // objects for + // search + // Folder + // objects public static final int NID_TYPE_SEARCH_CRITERIA_OBJECT = 0x07; // Defines /** * The constant NID_TYPE_ASSOC_MESSAGE. */ -// the - // search - // criteria - // for a - // search - // Folder - // object + // the + // search + // criteria + // for a + // search + // Folder + // object public static final int NID_TYPE_ASSOC_MESSAGE = 0x08; // Folder associated /** * The constant NID_TYPE_CONTENTS_TABLE_INDEX. */ -// information (FAI) - // Message object - // (PC) + // information (FAI) + // Message object + // (PC) public static final int NID_TYPE_CONTENTS_TABLE_INDEX = 0x0A; // Internal, /** * The constant NID_TYPE_RECEIVE_FOLDER_TABLE. */ -// persisted - // view-related + // persisted + // view-related public static final int NID_TYPE_RECEIVE_FOLDER_TABLE = 0X0B; // Receive /** * The constant NID_TYPE_OUTGOING_QUEUE_TABLE. */ -// Folder - // object - // (Inbox) + // Folder + // object + // (Inbox) public static final int NID_TYPE_OUTGOING_QUEUE_TABLE = 0x0C; // Outbound /** * The constant NID_TYPE_HIERARCHY_TABLE. */ -// queue - // (Outbox) + // queue + // (Outbox) public static final int NID_TYPE_HIERARCHY_TABLE = 0x0D; // Hierarchy table /** * The constant NID_TYPE_CONTENTS_TABLE. */ -// (TC) + // (TC) public static final int NID_TYPE_CONTENTS_TABLE = 0x0E; // Contents table /** * The constant NID_TYPE_ASSOC_CONTENTS_TABLE. */ -// (TC) + // (TC) public static final int NID_TYPE_ASSOC_CONTENTS_TABLE = 0x0F; // FAI /** * The constant NID_TYPE_SEARCH_CONTENTS_TABLE. */ -// contents - // table (TC) + // contents + // table (TC) public static final int NID_TYPE_SEARCH_CONTENTS_TABLE = 0x10; // Contents /** * The constant NID_TYPE_ATTACHMENT_TABLE. */ -// table (TC) - // of a - // search - // Folder - // object + // table (TC) + // of a + // search + // Folder + // object public static final int NID_TYPE_ATTACHMENT_TABLE = 0x11; // Attachment /** * The constant NID_TYPE_RECIPIENT_TABLE. */ -// table (TC) + // table (TC) public static final int NID_TYPE_RECIPIENT_TABLE = 0x12; // Recipient table /** * The constant NID_TYPE_SEARCH_TABLE_INDEX. */ -// (TC) + // (TC) public static final int NID_TYPE_SEARCH_TABLE_INDEX = 0x13; // Internal, /** * The constant NID_TYPE_LTP. */ -// persisted - // view-related + // persisted + // view-related public static final int NID_TYPE_LTP = 0x1F; // LTP /** @@ -216,15 +216,19 @@ public String getItemsString() { * @throws IOException the io exception */ protected PSTObject(final PSTFile theFile, final DescriptorIndexNode descriptorIndexNode) - throws PSTException, IOException { + throws PSTException, IOException { this.pstFile = theFile; this.descriptorIndexNode = descriptorIndexNode; // descriptorIndexNode.readData(theFile); // PSTTableBC table = new PSTTableBC(descriptorIndexNode.dataBlock.data, // descriptorIndexNode.dataBlock.blockOffsets); - final PSTTableBC table = new PSTTableBC(new PSTNodeInputStream(this.pstFile, - this.pstFile.getOffsetIndexNode(descriptorIndexNode.dataOffsetIndexIdentifier))); + final PSTTableBC table = new PSTTableBC( + new PSTNodeInputStream( + this.pstFile, + this.pstFile.getOffsetIndexNode(descriptorIndexNode.dataOffsetIndexIdentifier) + ) + ); // System.out.println(table); this.items = table.getItems(); @@ -232,8 +236,9 @@ protected PSTObject(final PSTFile theFile, final DescriptorIndexNode descriptorI // PSTDescriptor descriptor = new PSTDescriptor(theFile, // descriptorIndexNode.localDescriptorsOffsetIndexIdentifier); // localDescriptorItems = descriptor.getChildren(); - this.localDescriptorItems = theFile - .getPSTDescriptorItems(descriptorIndexNode.localDescriptorsOffsetIndexIdentifier); + this.localDescriptorItems = theFile.getPSTDescriptorItems( + descriptorIndexNode.localDescriptorsOffsetIndexIdentifier + ); } } @@ -245,8 +250,12 @@ protected PSTObject(final PSTFile theFile, final DescriptorIndexNode descriptorI * @param table the table * @param localDescriptorItems the local descriptor items */ - protected PSTObject(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + protected PSTObject( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { this.pstFile = theFile; this.descriptorIndexNode = folderIndexNode; this.items = table.getItems(); @@ -278,8 +287,8 @@ public DescriptorIndexNode getDescriptorNode() { */ public long getDescriptorNodeId() { if (this.descriptorIndexNode != null) { // Prevent null pointer - // exceptions for embedded - // messages + // exceptions for embedded + // messages return this.descriptorIndexNode.descriptorIdentifier; } return 0; @@ -408,8 +417,10 @@ protected long getLongItem(final int identifier, final long defaultValue) { if (item.data != null && item.data.length == 8) { return PSTObject.convertLittleEndianBytesToLong(item.data, 0, 8); } else { - if (PSTFile.isPrintErrors()) - System.err.printf("Invalid data length for long id 0x%04X\n", identifier); + if (PSTFile.isPrintErrors()) System.err.printf( + "Invalid data length for long id 0x%04X\n", + identifier + ); // Return the default value for now... } } @@ -449,7 +460,6 @@ protected String getStringItem(final int identifier, final int stringType) { protected String getStringItem(final int identifier, int stringType, String codepage) { final PSTTableBCItem item = this.items.get(identifier); if (item != null) { - if (codepage == null) { codepage = this.getStringCodepage(); } @@ -477,10 +487,12 @@ protected String getStringItem(final int identifier, int stringType, String code return PSTObject.createJavaString(data, stringType, codepage); } catch (final Exception e) { - if (PSTFile.isPrintErrors()) - System.err.printf("Exception %s decoding string %s: %s\n", e.toString(), - PSTFile.getPropertyDescription(identifier, stringType), - this.data != null ? this.data.toString() : "null"); + if (PSTFile.isPrintErrors()) System.err.printf( + "Exception %s decoding string %s: %s\n", + e.toString(), + PSTFile.getPropertyDescription(identifier, stringType), + this.data != null ? this.data.toString() : "null" + ); return ""; } // System.out.printf("PSTObject.getStringItem - item isn't a @@ -503,8 +515,7 @@ protected String getStringItem(final int identifier, int stringType, String code */ static String createJavaString(final byte[] data, final int stringType, String codepage) { try { - if (data == null) - return ""; + if (data == null) return ""; if (stringType == 0x1F) { return new String(data, "UTF-16LE"); @@ -537,8 +548,7 @@ static String createJavaString(final byte[] data, final int stringType, String c * } */ } catch (final Exception err) { - if (PSTFile.isPrintErrors()) - System.err.println("Unable to decode string"); + if (PSTFile.isPrintErrors()) System.err.println("Unable to decode string"); err.printStackTrace(); return ""; } @@ -561,10 +571,8 @@ public String getStringCodepage() { cpItem = this.items.get(0x3FDE); // PidTagInternetCodepage } } - if (cpItem != null) - codepage = PSTFile.getInternetCodePageCharset(cpItem.entryValueReference); - if (codepage == null) - codepage = pstFile.getGlobalCodepage(); + if (cpItem != null) codepage = PSTFile.getInternetCodePageCharset(cpItem.entryValueReference); + if (codepage == null) codepage = pstFile.getGlobalCodepage(); } return codepage; } @@ -602,21 +610,22 @@ protected byte[] getBinaryItem(final int identifier) { if (!item.isExternalValueReference) { return item.data; } - if (this.localDescriptorItems != null - && this.localDescriptorItems.containsKey(item.entryValueReference)) { + if ( + this.localDescriptorItems != null && this.localDescriptorItems.containsKey(item.entryValueReference) + ) { // we have a hit! final PSTDescriptorItem descItem = this.localDescriptorItems.get(item.entryValueReference); try { return descItem.getData(); } catch (final Exception e) { - if (PSTFile.isPrintErrors()) - System.err.printf("Exception reading binary item: reference 0x%08X\n", - item.entryValueReference); + if (PSTFile.isPrintErrors()) System.err.printf( + "Exception reading binary item: reference 0x%08X\n", + item.entryValueReference + ); return null; } } - // System.out.println("External reference!!!\n"); } } @@ -715,22 +724,265 @@ public Date getLastModificationTime() { * Static stuff below * ------------------ */ -// substitution table for the compressible encryption type. - static int[] compEnc = {0x47, 0xf1, 0xb4, 0xe6, 0x0b, 0x6a, 0x72, 0x48, 0x85, 0x4e, 0x9e, 0xeb, 0xe2, 0xf8, 0x94, - 0x53, 0xe0, 0xbb, 0xa0, 0x02, 0xe8, 0x5a, 0x09, 0xab, 0xdb, 0xe3, 0xba, 0xc6, 0x7c, 0xc3, 0x10, 0xdd, 0x39, - 0x05, 0x96, 0x30, 0xf5, 0x37, 0x60, 0x82, 0x8c, 0xc9, 0x13, 0x4a, 0x6b, 0x1d, 0xf3, 0xfb, 0x8f, 0x26, 0x97, - 0xca, 0x91, 0x17, 0x01, 0xc4, 0x32, 0x2d, 0x6e, 0x31, 0x95, 0xff, 0xd9, 0x23, 0xd1, 0x00, 0x5e, 0x79, 0xdc, - 0x44, 0x3b, 0x1a, 0x28, 0xc5, 0x61, 0x57, 0x20, 0x90, 0x3d, 0x83, 0xb9, 0x43, 0xbe, 0x67, 0xd2, 0x46, 0x42, - 0x76, 0xc0, 0x6d, 0x5b, 0x7e, 0xb2, 0x0f, 0x16, 0x29, 0x3c, 0xa9, 0x03, 0x54, 0x0d, 0xda, 0x5d, 0xdf, 0xf6, - 0xb7, 0xc7, 0x62, 0xcd, 0x8d, 0x06, 0xd3, 0x69, 0x5c, 0x86, 0xd6, 0x14, 0xf7, 0xa5, 0x66, 0x75, 0xac, 0xb1, - 0xe9, 0x45, 0x21, 0x70, 0x0c, 0x87, 0x9f, 0x74, 0xa4, 0x22, 0x4c, 0x6f, 0xbf, 0x1f, 0x56, 0xaa, 0x2e, 0xb3, - 0x78, 0x33, 0x50, 0xb0, 0xa3, 0x92, 0xbc, 0xcf, 0x19, 0x1c, 0xa7, 0x63, 0xcb, 0x1e, 0x4d, 0x3e, 0x4b, 0x1b, - 0x9b, 0x4f, 0xe7, 0xf0, 0xee, 0xad, 0x3a, 0xb5, 0x59, 0x04, 0xea, 0x40, 0x55, 0x25, 0x51, 0xe5, 0x7a, 0x89, - 0x38, 0x68, 0x52, 0x7b, 0xfc, 0x27, 0xae, 0xd7, 0xbd, 0xfa, 0x07, 0xf4, 0xcc, 0x8e, 0x5f, 0xef, 0x35, 0x9c, - 0x84, 0x2b, 0x15, 0xd5, 0x77, 0x34, 0x49, 0xb6, 0x12, 0x0a, 0x7f, 0x71, 0x88, 0xfd, 0x9d, 0x18, 0x41, 0x7d, - 0x93, 0xd8, 0x58, 0x2c, 0xce, 0xfe, 0x24, 0xaf, 0xde, 0xb8, 0x36, 0xc8, 0xa1, 0x80, 0xa6, 0x99, 0x98, 0xa8, - 0x2f, 0x0e, 0x81, 0x65, 0x73, 0xe4, 0xc2, 0xa2, 0x8a, 0xd4, 0xe1, 0x11, 0xd0, 0x08, 0x8b, 0x2a, 0xf2, 0xed, - 0x9a, 0x64, 0x3f, 0xc1, 0x6c, 0xf9, 0xec}; + // substitution table for the compressible encryption type. + static int[] compEnc = { + 0x47, + 0xf1, + 0xb4, + 0xe6, + 0x0b, + 0x6a, + 0x72, + 0x48, + 0x85, + 0x4e, + 0x9e, + 0xeb, + 0xe2, + 0xf8, + 0x94, + 0x53, + 0xe0, + 0xbb, + 0xa0, + 0x02, + 0xe8, + 0x5a, + 0x09, + 0xab, + 0xdb, + 0xe3, + 0xba, + 0xc6, + 0x7c, + 0xc3, + 0x10, + 0xdd, + 0x39, + 0x05, + 0x96, + 0x30, + 0xf5, + 0x37, + 0x60, + 0x82, + 0x8c, + 0xc9, + 0x13, + 0x4a, + 0x6b, + 0x1d, + 0xf3, + 0xfb, + 0x8f, + 0x26, + 0x97, + 0xca, + 0x91, + 0x17, + 0x01, + 0xc4, + 0x32, + 0x2d, + 0x6e, + 0x31, + 0x95, + 0xff, + 0xd9, + 0x23, + 0xd1, + 0x00, + 0x5e, + 0x79, + 0xdc, + 0x44, + 0x3b, + 0x1a, + 0x28, + 0xc5, + 0x61, + 0x57, + 0x20, + 0x90, + 0x3d, + 0x83, + 0xb9, + 0x43, + 0xbe, + 0x67, + 0xd2, + 0x46, + 0x42, + 0x76, + 0xc0, + 0x6d, + 0x5b, + 0x7e, + 0xb2, + 0x0f, + 0x16, + 0x29, + 0x3c, + 0xa9, + 0x03, + 0x54, + 0x0d, + 0xda, + 0x5d, + 0xdf, + 0xf6, + 0xb7, + 0xc7, + 0x62, + 0xcd, + 0x8d, + 0x06, + 0xd3, + 0x69, + 0x5c, + 0x86, + 0xd6, + 0x14, + 0xf7, + 0xa5, + 0x66, + 0x75, + 0xac, + 0xb1, + 0xe9, + 0x45, + 0x21, + 0x70, + 0x0c, + 0x87, + 0x9f, + 0x74, + 0xa4, + 0x22, + 0x4c, + 0x6f, + 0xbf, + 0x1f, + 0x56, + 0xaa, + 0x2e, + 0xb3, + 0x78, + 0x33, + 0x50, + 0xb0, + 0xa3, + 0x92, + 0xbc, + 0xcf, + 0x19, + 0x1c, + 0xa7, + 0x63, + 0xcb, + 0x1e, + 0x4d, + 0x3e, + 0x4b, + 0x1b, + 0x9b, + 0x4f, + 0xe7, + 0xf0, + 0xee, + 0xad, + 0x3a, + 0xb5, + 0x59, + 0x04, + 0xea, + 0x40, + 0x55, + 0x25, + 0x51, + 0xe5, + 0x7a, + 0x89, + 0x38, + 0x68, + 0x52, + 0x7b, + 0xfc, + 0x27, + 0xae, + 0xd7, + 0xbd, + 0xfa, + 0x07, + 0xf4, + 0xcc, + 0x8e, + 0x5f, + 0xef, + 0x35, + 0x9c, + 0x84, + 0x2b, + 0x15, + 0xd5, + 0x77, + 0x34, + 0x49, + 0xb6, + 0x12, + 0x0a, + 0x7f, + 0x71, + 0x88, + 0xfd, + 0x9d, + 0x18, + 0x41, + 0x7d, + 0x93, + 0xd8, + 0x58, + 0x2c, + 0xce, + 0xfe, + 0x24, + 0xaf, + 0xde, + 0xb8, + 0x36, + 0xc8, + 0xa1, + 0x80, + 0xa6, + 0x99, + 0x98, + 0xa8, + 0x2f, + 0x0e, + 0x81, + 0x65, + 0x73, + 0xe4, + 0xc2, + 0xa2, + 0x8a, + 0xd4, + 0xe1, + 0x11, + 0xd0, + 0x08, + 0x8b, + 0x2a, + 0xf2, + 0xed, + 0x9a, + 0x64, + 0x3f, + 0xc1, + 0x6c, + 0xf9, + 0xec, + }; /** * Output a number in a variety of formats for easier consumption @@ -823,8 +1075,7 @@ protected static void printHexFormatted(final byte[] data, final boolean pretty, System.out.println(" " + line); System.out.println("---"); System.out.println(data.length); - } else { - } + } else {} } /** @@ -888,7 +1139,6 @@ public static long convertLittleEndianBytesToLong(final byte[] data) { * @return long version of the data */ public static long convertLittleEndianBytesToLong(final byte[] data, final int start, final int end) { - long offset = data[end - 1] & 0xff; long tmpLongValue; for (int x = end - 2; x >= start; x--) { @@ -909,7 +1159,6 @@ public static long convertLittleEndianBytesToLong(final byte[] data, final int s * @return long version of the data */ public static long convertBigEndianBytesToLong(final byte[] data, final int start, final int end) { - long offset = 0; for (int x = start; x < end; ++x) { offset = offset << 8; @@ -918,6 +1167,7 @@ public static long convertBigEndianBytesToLong(final byte[] data, final int star return offset; } + /* * protected static boolean isPSTArray(byte[] data) { * return (data[0] == 1 && data[1] == 1); @@ -973,7 +1223,7 @@ public static long convertBigEndianBytesToLong(final byte[] data, final int star * @throws PSTException the pst exception */ public static PSTObject detectAndLoadPSTObject(final PSTFile theFile, final long descriptorIndex) - throws IOException, PSTException { + throws IOException, PSTException { return PSTObject.detectAndLoadPSTObject(theFile, theFile.getDescriptorIndexNode(descriptorIndex)); } @@ -988,28 +1238,34 @@ public static PSTObject detectAndLoadPSTObject(final PSTFile theFile, final long * @throws PSTException the pst exception */ static PSTObject detectAndLoadPSTObject(final PSTFile theFile, final DescriptorIndexNode folderIndexNode) - throws IOException, PSTException { + throws IOException, PSTException { final int nidType = (folderIndexNode.descriptorIdentifier & 0x1F); if (nidType == 0x02 || nidType == 0x03 || nidType == 0x04) { - final PSTTableBC table = new PSTTableBC( - new PSTNodeInputStream(theFile, theFile.getOffsetIndexNode(folderIndexNode.dataOffsetIndexIdentifier))); + new PSTNodeInputStream(theFile, theFile.getOffsetIndexNode(folderIndexNode.dataOffsetIndexIdentifier)) + ); HashMap localDescriptorItems = null; if (folderIndexNode.localDescriptorsOffsetIndexIdentifier != 0) { - localDescriptorItems = theFile - .getPSTDescriptorItems(folderIndexNode.localDescriptorsOffsetIndexIdentifier); + localDescriptorItems = theFile.getPSTDescriptorItems( + folderIndexNode.localDescriptorsOffsetIndexIdentifier + ); } if (nidType == 0x02 || nidType == 0x03) { return new PSTFolder(theFile, folderIndexNode, table, localDescriptorItems); } else { - return PSTObject.createAppropriatePSTMessageObject(theFile, folderIndexNode, table, - localDescriptorItems); + return PSTObject.createAppropriatePSTMessageObject( + theFile, + folderIndexNode, + table, + localDescriptorItems + ); } } else { throw new PSTException( - "Unknown child type with offset id: " + folderIndexNode.localDescriptorsOffsetIndexIdentifier); + "Unknown child type with offset id: " + folderIndexNode.localDescriptorsOffsetIndexIdentifier + ); } } @@ -1022,22 +1278,25 @@ static PSTObject detectAndLoadPSTObject(final PSTFile theFile, final DescriptorI * @param localDescriptorItems the local descriptor items * @return the pst message */ - static PSTMessage createAppropriatePSTMessageObject(final PSTFile theFile, - final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { - + static PSTMessage createAppropriatePSTMessageObject( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { final PSTTableBCItem item = table.getItems().get(0x001a); String messageClass = ""; if (item != null) { messageClass = item.getStringValue("US-ASCII"); } - if (messageClass.equals("IPM.Note") - || messageClass.equals("IPM.Note.SMIME.MultipartSigned")) { + if (messageClass.equals("IPM.Note") || messageClass.equals("IPM.Note.SMIME.MultipartSigned")) { return new PSTMessage(theFile, folderIndexNode, table, localDescriptorItems); - } else if (messageClass.startsWith("IPM.Appointment") - || messageClass.equals("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}") - || messageClass.startsWith("IPM.Schedule.Meeting")) { + } else if ( + messageClass.startsWith("IPM.Appointment") || + messageClass.equals("IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}") || + messageClass.startsWith("IPM.Schedule.Meeting") + ) { return new PSTAppointment(theFile, folderIndexNode, table, localDescriptorItems); } else if (messageClass.equals("IPM.AbchPerson")) { return new PSTContact(theFile, folderIndexNode, table, localDescriptorItems); @@ -1052,8 +1311,7 @@ static PSTMessage createAppropriatePSTMessageObject(final PSTFile theFile, } else if (messageClass.equals("IPM.DistList")) { return new PSTDistList(theFile, folderIndexNode, table, localDescriptorItems); } else { - if (PSTFile.isPrintErrors()) - System.err.println("Unknown message type: " + messageClass); + if (PSTFile.isPrintErrors()) System.err.println("Unknown message type: " + messageClass); } return new PSTMessage(theFile, folderIndexNode, table, localDescriptorItems); @@ -1069,10 +1327,10 @@ static PSTMessage createAppropriatePSTMessageObject(final PSTFile theFile, * @throws PSTException the pst exception */ static String guessPSTObjectType(final PSTFile theFile, final DescriptorIndexNode folderIndexNode) - throws IOException, PSTException { - + throws IOException, PSTException { final PSTTableBC table = new PSTTableBC( - new PSTNodeInputStream(theFile, theFile.getOffsetIndexNode(folderIndexNode.dataOffsetIndexIdentifier))); + new PSTNodeInputStream(theFile, theFile.getOffsetIndexNode(folderIndexNode.dataOffsetIndexIdentifier)) + ); // get the table items and look at the types we are dealing with final Set keySet = table.getItems().keySet(); @@ -1134,7 +1392,7 @@ static String guessPSTObjectType(final PSTFile theFile, final DescriptorIndexNod * @return The Windows FILETIME as a {@link Date}. */ protected static Date filetimeToDate(final int high, final int low) { - final long filetime = ((long) high) << 32 | (low & 0xffffffffL); + final long filetime = (((long) high) << 32) | (low & 0xffffffffL); // System.out.printf("0x%X\n", filetime); final long ms_since_16010101 = filetime / (1000 * 10); final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java index 6186d417..54b49816 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRAFileContent.java @@ -60,7 +60,7 @@ public void setFile(final RandomAccessFile file) { @Override public void seek(final long index) throws IOException { - // collectCallStack(); cf PSTFileContent + // collectCallStack(); cf PSTFileContent this.file.seek(index); } @@ -71,26 +71,25 @@ public long getFilePointer() throws IOException { @Override public int read() throws IOException { - // collectCallStack(); cf PSTFileContent + // collectCallStack(); cf PSTFileContent return this.file.read(); } @Override public int read(final byte[] target) throws IOException { - // collectCallStack(); cf PSTFileContent + // collectCallStack(); cf PSTFileContent return this.file.read(target); } @Override public byte readByte() throws IOException { - // collectCallStack(); cf PSTFileContent + // collectCallStack(); cf PSTFileContent return this.file.readByte(); } @Override public void close() throws IOException { - // systemOutTraceLines(); cf PSTFileContent + // systemOutTraceLines(); cf PSTFileContent this.file.close(); } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java index 4cfae28c..efc8eabe 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRecipient.java @@ -42,12 +42,13 @@ /** * Class containing recipient information - * + * * @author Orin Eman * * */ public class PSTRecipient { + private final HashMap details; public static final int MAPI_TO = 1; @@ -56,8 +57,8 @@ public class PSTRecipient { private PSTMessage message; - PSTRecipient(PSTMessage message,final HashMap recipientDetails) { - this.message=message; + PSTRecipient(PSTMessage message, final HashMap recipientDetails) { + this.message = message; this.details = recipientDetails; } @@ -118,7 +119,7 @@ private String getString(final int id) { * return (item.entryValueReference & 0xFF) == 0 ? false : true; * } * } - * + * * return false; * } */ @@ -137,18 +138,17 @@ private int getInt(final int id) { return 0; } - /* * private Date getDate(int id) { * long lDate = 0; - * + * * if ( details.containsKey(id) ) { * PSTTable7CItem item = details.get(id); * if ( item.entryValueType == 0x0040 ) { * int high = (int)PSTObject.convertLittleEndianBytesToLong(item.data, 4, * 8); * int low = (int)PSTObject.convertLittleEndianBytesToLong(item.data, 0, 4); - * + * * return PSTObject.filetimeToDate(high, low); * } * } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java index de720db2..ef4725a4 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTRss.java @@ -42,7 +42,7 @@ /** * Object that represents a RSS item - * + * * @author Richard Johnson */ public class PSTRss extends PSTMessage { @@ -68,8 +68,12 @@ public PSTRss(final PSTFile theFile, final DescriptorIndexNode descriptorIndexNo * @param table the table * @param localDescriptorItems the local descriptor items */ - public PSTRss(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + public PSTRss( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -138,12 +142,27 @@ public String getPostRssSubscription() { @Override public String toString() { - return "Channel ASCII or Unicode string values: " + this.getPostRssChannelLink() + "\n" - + "Item link ASCII or Unicode string values: " + this.getPostRssItemLink() + "\n" - + "Item hash Integer 32-bit signed: " + this.getPostRssItemHash() + "\n" - + "Item GUID ASCII or Unicode string values: " + this.getPostRssItemGuid() + "\n" - + "Channel GUID ASCII or Unicode string values: " + this.getPostRssChannel() + "\n" - + "Item XML ASCII or Unicode string values: " + this.getPostRssItemXml() + "\n" - + "Subscription ASCII or Unicode string values: " + this.getPostRssSubscription(); + return ( + "Channel ASCII or Unicode string values: " + + this.getPostRssChannelLink() + + "\n" + + "Item link ASCII or Unicode string values: " + + this.getPostRssItemLink() + + "\n" + + "Item hash Integer 32-bit signed: " + + this.getPostRssItemHash() + + "\n" + + "Item GUID ASCII or Unicode string values: " + + this.getPostRssItemGuid() + + "\n" + + "Channel GUID ASCII or Unicode string values: " + + this.getPostRssChannel() + + "\n" + + "Item XML ASCII or Unicode string values: " + + this.getPostRssItemXml() + + "\n" + + "Subscription ASCII or Unicode string values: " + + this.getPostRssSubscription() + ); } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java index f181b099..47f92798 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable.java @@ -45,7 +45,7 @@ * It allows for an item to be read and broken down into the individual * properties that it consists of. * For most PST Objects, it appears that only 7c and bc table types are used. - * + * * @author Richard Johnson */ class PSTTable { @@ -92,31 +92,32 @@ protected PSTTable(final PSTNodeInputStream in, final HashMap end) { throw new PSTException( - String.format("Invalid NodeInfo parameters: start %1$d is greater than end %2$d", start, end)); + String.format("Invalid NodeInfo parameters: start %1$d is greater than end %2$d", start, end) + ); } this.startOffset = start; this.endOffset = end; @@ -208,7 +230,6 @@ long seekAndReadLong(final long offset, final int length) throws IOException, PS } protected NodeInfo getNodeInfo(final int hnid) throws PSTException, IOException { - // Zero-length node? if (hnid == 0) { return new NodeInfo(0, 0, this.in); @@ -267,5 +288,4 @@ protected NodeInfo getNodeInfo(final int hnid) throws PSTException, IOException final NodeInfo out = new NodeInfo(start, end, this.in); return out; } - } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java index b6b872d0..fad91ab5 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7C.java @@ -38,10 +38,6 @@ package fr.gouv.vitam.tools.javalibpst; import java.io.IOException; -/* - * import java.io.UnsupportedEncodingException; - * / - **/ import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -51,7 +47,7 @@ /** * Specific functions for the 7c table type ("Table Context"). * This is used for attachments. - * + * * @author Richard Johnson */ class PSTTable7C extends PSTTable { @@ -71,10 +67,12 @@ protected PSTTable7C(final PSTNodeInputStream in, final HashMap subNodeDescriptorItems, - final int entityToExtract) throws PSTException, IOException { + protected PSTTable7C( + final PSTNodeInputStream in, + final HashMap subNodeDescriptorItems, + final int entityToExtract + ) throws PSTException, IOException { super(in, subNodeDescriptorItems); - if (this.tableTypeByte != 0x7c) { // System.out.println(Long.toHexString(this.tableTypeByte)); throw new PSTException("unable to create PSTTable7C, table does not appear to be a 7c!"); @@ -91,17 +89,11 @@ protected PSTTable7C(final PSTNodeInputStream in, final HashMap> getItems(int startAtRecord, int numberOfR final int numberOfBlocks = this.rowNodeInfo.length() / this.BLOCK_SIZE; final int numberOfRowsPerBlock = this.BLOCK_SIZE / this.TCI_bm; final int blockPadding = this.BLOCK_SIZE - (numberOfRowsPerBlock * this.TCI_bm); - this.numberOfDataSets = (numberOfBlocks * numberOfRowsPerBlock) - + ((this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm); + this.numberOfDataSets = (numberOfBlocks * numberOfRowsPerBlock) + + ((this.rowNodeInfo.length() % this.BLOCK_SIZE) / this.TCI_bm); if (startAtRecord == -1) { numberOfRecordsToReturn = this.numberOfDataSets; @@ -210,8 +214,9 @@ List> getItems(int startAtRecord, int numberOfR } // repeat the reading process for every dataset - int currentValueArrayStart = ((startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE) - + ((startAtRecord % numberOfRowsPerBlock) * this.TCI_bm); + int currentValueArrayStart = + ((startAtRecord / numberOfRowsPerBlock) * this.BLOCK_SIZE) + + ((startAtRecord % numberOfRowsPerBlock) * this.TCI_bm); if (numberOfRecordsToReturn > this.getRowCount() - startAtRecord) { numberOfRecordsToReturn = this.getRowCount() - startAtRecord; @@ -223,8 +228,8 @@ List> getItems(int startAtRecord, int numberOfR for (int rowCounter = 0; rowCounter < numberOfRecordsToReturn; rowCounter++) { final HashMap currentItem = new HashMap<>(); // to respect block boundaries - currentValueArrayStart = (((startAtRecord+rowCounter) / numberOfRowsPerBlock) * this.BLOCK_SIZE) - + (((startAtRecord+rowCounter) % numberOfRowsPerBlock) * this.TCI_bm); + currentValueArrayStart = (((startAtRecord + rowCounter) / numberOfRowsPerBlock) * this.BLOCK_SIZE) + + (((startAtRecord + rowCounter) % numberOfRowsPerBlock) * this.TCI_bm); final byte[] bitmap = new byte[(this.cCols + 7) / 8]; @@ -233,7 +238,7 @@ List> getItems(int startAtRecord, int numberOfR final int id = (int) this.rowNodeInfo.seekAndReadLong(currentValueArrayStart, 4); - // Put into the item map as PidTagLtpRowId (0x67F2) + // Put into the item map as PidTagLtpRowId (0x67F2) PSTTable7CItem item = new PSTTable7CItem(); item.itemIndex = -1; item.entryValueType = 3; @@ -266,140 +271,149 @@ List> getItems(int startAtRecord, int numberOfR item.entryValueReference = 0; switch (this.columnDescriptors[col].cbData) { - case 1: // Single byte data - // item.entryValueReference = - // rowNodeInfo[currentValueArrayStart+columnDescriptors[col].ibData] - // & 0xFF; - item.entryValueReference = (int) this.rowNodeInfo - .seekAndReadLong(currentValueArrayStart + this.columnDescriptors[col].ibData, 1) & 0xFF; - item.isExternalValueReference = true; - /* - * System.out.printf("\tboolean: %s %s\n", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), - * item.entryValueReference == 0 ? "false" : "true"); - * / - **/ - break; - - case 2: // Two byte data - /* - * item.entryValueReference = - * (rowNodeInfo[currentValueArrayStart+columnDescriptors[col - * ].ibData] & 0xFF) | - * ((rowNodeInfo[currentValueArrayStart+columnDescriptors[ - * col].ibData+1] & 0xFF) << 8); - */ - item.entryValueReference = (int) this.rowNodeInfo - .seekAndReadLong(currentValueArrayStart + this.columnDescriptors[col].ibData, 2) & 0xFFFF; - item.isExternalValueReference = true; - /* - * short i16 = (short)item.entryValueReference; - * System.out.printf("\tInteger16: %s %d\n", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), - * i16); - * / - **/ - break; - - case 8: // 8 byte data - item.data = new byte[8]; - // System.arraycopy(rowNodeInfo, - // currentValueArrayStart+columnDescriptors[col].ibData, - // item.data, 0, 8); - this.rowNodeInfo.in.seek( - this.rowNodeInfo.startOffset + currentValueArrayStart + this.columnDescriptors[col].ibData); - this.rowNodeInfo.in.readCompletely(item.data); - /* - * System.out.printf("\tInteger64: %s\n", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType)); / - **/ - break; - - default:// Four byte data - - /* - * if (numberOfIndexLevels > 0 ) { - * System.out.println("here"); - * System.out.println(rowNodeInfo.length()); - * PSTObject.printHexFormatted(rowNodeInfo, true); - * System.exit(0); - * } - */ - - // item.entryValueReference = - // (int)PSTObject.convertLittleEndianBytesToLong(rowNodeInfo, - // currentValueArrayStart+columnDescriptors[col].ibData, - // currentValueArrayStart+columnDescriptors[col].ibData+4); - item.entryValueReference = (int) this.rowNodeInfo - .seekAndReadLong(currentValueArrayStart + this.columnDescriptors[col].ibData, 4); - if (this.columnDescriptors[col].type == 0x0003 || this.columnDescriptors[col].type == 0x0004 - || this.columnDescriptors[col].type == 0x000A) { - // True 32bit data + case 1: // Single byte data + // item.entryValueReference = + // rowNodeInfo[currentValueArrayStart+columnDescriptors[col].ibData] + // & 0xFF; + item.entryValueReference = (int) this.rowNodeInfo.seekAndReadLong( + currentValueArrayStart + this.columnDescriptors[col].ibData, + 1 + ) & + 0xFF; item.isExternalValueReference = true; /* - * System.out.printf("\tInteger32: %s %d\n", + * System.out.printf("\tboolean: %s %s\n", * PSTFile.getPropertyDescription(item.entryType, * item.entryValueType), - * item.entryValueReference); / + * item.entryValueReference == 0 ? "false" : "true"); + * / **/ break; - } - - // Variable length data so it's an hnid - if ((item.entryValueReference & 0x1F) != 0) { - // Some kind of external reference... + case 2: // Two byte data + /* + * item.entryValueReference = + * (rowNodeInfo[currentValueArrayStart+columnDescriptors[col + * ].ibData] & 0xFF) | + * ((rowNodeInfo[currentValueArrayStart+columnDescriptors[ + * col].ibData+1] & 0xFF) << 8); + */ + item.entryValueReference = (int) this.rowNodeInfo.seekAndReadLong( + currentValueArrayStart + this.columnDescriptors[col].ibData, + 2 + ) & + 0xFFFF; item.isExternalValueReference = true; /* - * System.out.printf("\tOther: %s 0x%08X\n", + * short i16 = (short)item.entryValueReference; + * System.out.printf("\tInteger16: %s %d\n", * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), item.entryValueReference); / + * item.entryValueType), + * i16); + * / **/ break; - } - - if (item.entryValueReference == 0) { + case 8: // 8 byte data + item.data = new byte[8]; + // System.arraycopy(rowNodeInfo, + // currentValueArrayStart+columnDescriptors[col].ibData, + // item.data, 0, 8); + this.rowNodeInfo.in.seek( + this.rowNodeInfo.startOffset + + currentValueArrayStart + + this.columnDescriptors[col].ibData + ); + this.rowNodeInfo.in.readCompletely(item.data); /* - * System.out.printf("\tOther: %s 0 bytes\n", + * System.out.printf("\tInteger64: %s\n", * PSTFile.getPropertyDescription(item.entryType, * item.entryValueType)); / **/ - item.data = new byte[0]; break; - } else { - final NodeInfo entryInfo = this.getNodeInfo(item.entryValueReference); - item.data = new byte[entryInfo.length()]; - // System.arraycopy(entryInfo, 0, item.data, 0, - // item.data.length); - entryInfo.in.seek(entryInfo.startOffset); - entryInfo.in.readCompletely(item.data); - } - /* - * if ( item.entryValueType != 0x001F ) { - * System.out.printf("\tOther: %s %d bytes\n", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), - * item.data.length); - * } else { - * try { - * String s = new String(item.data, "UTF-16LE"); - * System.out.printf("\tString: %s \"%s\"\n", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), - * s); - * } catch (UnsupportedEncodingException e) { - * e.printStackTrace(); - * } - * } - * / - **/ - break; + default: // Four byte data + /* + * if (numberOfIndexLevels > 0 ) { + * System.out.println("here"); + * System.out.println(rowNodeInfo.length()); + * PSTObject.printHexFormatted(rowNodeInfo, true); + * System.exit(0); + * } + */ + + // item.entryValueReference = + // (int)PSTObject.convertLittleEndianBytesToLong(rowNodeInfo, + // currentValueArrayStart+columnDescriptors[col].ibData, + // currentValueArrayStart+columnDescriptors[col].ibData+4); + item.entryValueReference = (int) this.rowNodeInfo.seekAndReadLong( + currentValueArrayStart + this.columnDescriptors[col].ibData, + 4 + ); + if ( + this.columnDescriptors[col].type == 0x0003 || + this.columnDescriptors[col].type == 0x0004 || + this.columnDescriptors[col].type == 0x000A + ) { + // True 32bit data + item.isExternalValueReference = true; + /* + * System.out.printf("\tInteger32: %s %d\n", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType), + * item.entryValueReference); / + **/ + break; + } + + // Variable length data so it's an hnid + if ((item.entryValueReference & 0x1F) != 0) { + // Some kind of external reference... + item.isExternalValueReference = true; + /* + * System.out.printf("\tOther: %s 0x%08X\n", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType), item.entryValueReference); / + **/ + break; + } + + if (item.entryValueReference == 0) { + /* + * System.out.printf("\tOther: %s 0 bytes\n", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType)); / + **/ + item.data = new byte[0]; + break; + } else { + final NodeInfo entryInfo = this.getNodeInfo(item.entryValueReference); + item.data = new byte[entryInfo.length()]; + // System.arraycopy(entryInfo, 0, item.data, 0, + // item.data.length); + entryInfo.in.seek(entryInfo.startOffset); + entryInfo.in.readCompletely(item.data); + } + /* + * if ( item.entryValueType != 0x001F ) { + * System.out.printf("\tOther: %s %d bytes\n", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType), + * item.data.length); + * } else { + * try { + * String s = new String(item.data, "UTF-16LE"); + * System.out.printf("\tString: %s \"%s\"\n", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType), + * s); + * } catch (UnsupportedEncodingException e) { + * e.printStackTrace(); + * } + * } + * / + **/ + break; } currentItem.put(item.entryType, item); - // description += item.toString()+"\n\n"; } itemList.add(dataSetNumber, currentItem); @@ -412,6 +426,7 @@ List> getItems(int startAtRecord, int numberOfR } class ColumnDescriptor { + ColumnDescriptor(final NodeInfo nodeInfo, final int offset) throws PSTException, IOException { // type = (int)(PSTObject.convertLittleEndianBytesToLong(data, // offset, offset+2) & 0xFFFF); @@ -446,7 +461,7 @@ public int getRowCount() { * if ( items == null || itemNumber >= items.size() ) { * return null; * } - * + * * return items.get(itemNumber); * } * / diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java index ce5988b1..62d783a6 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTable7CItem.java @@ -39,7 +39,7 @@ /** * Items found in the 7c tables - * + * * @author Richard Johnson */ class PSTTable7CItem extends PSTTableItem { diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java index 776d5069..502441ae 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBC.java @@ -42,7 +42,7 @@ /** * The BC Table type. (Property Context) * Used by pretty much everything. - * + * * @author Richard Johnson */ class PSTTableBC extends PSTTable { @@ -78,24 +78,25 @@ class PSTTableBC extends PSTTable { // Read the key table int offset = 0; for (int x = 0; x < this.numberOfKeys; x++) { - final PSTTableBCItem item = new PSTTableBCItem(); item.itemIndex = x; item.entryType = (int) PSTObject.convertLittleEndianBytesToLong(keyTableInfo, offset + 0, offset + 2); // item.entryType =(int)in.seekAndReadLong(offset, 2); item.entryValueType = (int) PSTObject.convertLittleEndianBytesToLong(keyTableInfo, offset + 2, offset + 4); // item.entryValueType = (int)in.seekAndReadLong(offset+2, 2); - item.entryValueReference = (int) PSTObject.convertLittleEndianBytesToLong(keyTableInfo, offset + 4, - offset + 8); + item.entryValueReference = (int) PSTObject.convertLittleEndianBytesToLong( + keyTableInfo, + offset + 4, + offset + 8 + ); // item.entryValueReference = (int)in.seekAndReadLong(offset+4, 4); // Data is in entryValueReference for all types <= 4 bytes long switch (item.entryValueType) { - - case 0x0002: // 16bit integer - item.entryValueReference &= 0xFFFF; - case 0x0003: // 32bit integer - case 0x000A: // 32bit error code + case 0x0002: // 16bit integer + item.entryValueReference &= 0xFFFF; + case 0x0003: // 32bit integer + case 0x000A: // 32bit error code /* * System.out.printf("Integer%s: 0x%04X:%04X, %d\n", * (item.entryValueType == 0x0002) ? "16" : "32", @@ -103,78 +104,76 @@ class PSTTableBC extends PSTTable { * item.entryValueReference); * / **/ - case 0x0001: // Place-holder - case 0x0004: // 32bit floating - item.isExternalValueReference = true; - break; - - case 0x000b: // Boolean - a single byte - item.entryValueReference &= 0xFF; - /* - * System.out.printf("boolean: 0x%04X:%04X, %s\n", - * item.entryType, item.entryValueType, - * (item.entryValueReference == 0) ? "false" : "true"); - * / - **/ - item.isExternalValueReference = true; - break; - - case 0x000D: - default: - // Is it in the local heap? - item.isExternalValueReference = true; // Assume not - // System.out.println(item.entryValueReference); - // byte[] nodeInfo = getNodeInfo(item.entryValueReference); - final NodeInfo nodeInfoNodeInfo = this.getNodeInfo(item.entryValueReference); - if (nodeInfoNodeInfo == null) { - // It's an external reference that we don't deal with here. - /* - * System.out.printf("%s: %shid 0x%08X\n", - * (item.entryValueType == 0x1f || item.entryValueType == - * 0x1e) ? "String" : "Other", - * PSTFile.getPropertyDescription(item.entryType, - * item.entryValueType), - * item.entryValueReference); - * / - **/ - } else { - // Make a copy of the data - // item.data = new - // byte[nodeInfo.endOffset-nodeInfo.startOffset]; - final byte[] nodeInfo = new byte[nodeInfoNodeInfo.length()]; - nodeInfoNodeInfo.in.seek(nodeInfoNodeInfo.startOffset); - nodeInfoNodeInfo.in.readCompletely(nodeInfo); - item.data = nodeInfo; // should be new array, so just use it - // System.arraycopy(nodeInfo.data, nodeInfo.startOffset, - // item.data, 0, item.data.length); - item.isExternalValueReference = false; + case 0x0001: // Place-holder + case 0x0004: // 32bit floating + item.isExternalValueReference = true; + break; + case 0x000b: // Boolean - a single byte + item.entryValueReference &= 0xFF; /* - * if ( item.entryValueType == 0x1f || - * item.entryValueType == 0x1e ) - * { - * try { - * // if ( item.entryType == 0x0037 ) - * { - * String temp = new String(item.data, item.entryValueType - * == 0x1E ? "UTF8" : "UTF-16LE"); - * System.out.printf("String: 0x%04X:%04X, \"%s\"\n", - * item.entryType, item.entryValueType, temp); - * } - * } catch (UnsupportedEncodingException e) { - * e.printStackTrace(); - * } - * } - * else - * { - * - * System.out.printf("Other: 0x%04X:%04X, %d bytes\n", - * item.entryType, item.entryValueType, item.data.length); - * - * } + * System.out.printf("boolean: 0x%04X:%04X, %s\n", + * item.entryType, item.entryValueType, + * (item.entryValueReference == 0) ? "false" : "true"); * / **/ - } - break; + item.isExternalValueReference = true; + break; + case 0x000D: + default: + // Is it in the local heap? + item.isExternalValueReference = true; // Assume not + // System.out.println(item.entryValueReference); + // byte[] nodeInfo = getNodeInfo(item.entryValueReference); + final NodeInfo nodeInfoNodeInfo = this.getNodeInfo(item.entryValueReference); + if (nodeInfoNodeInfo == null) { + // It's an external reference that we don't deal with here. + /* + * System.out.printf("%s: %shid 0x%08X\n", + * (item.entryValueType == 0x1f || item.entryValueType == + * 0x1e) ? "String" : "Other", + * PSTFile.getPropertyDescription(item.entryType, + * item.entryValueType), + * item.entryValueReference); + * / + **/ + } else { + // Make a copy of the data + // item.data = new + // byte[nodeInfo.endOffset-nodeInfo.startOffset]; + final byte[] nodeInfo = new byte[nodeInfoNodeInfo.length()]; + nodeInfoNodeInfo.in.seek(nodeInfoNodeInfo.startOffset); + nodeInfoNodeInfo.in.readCompletely(nodeInfo); + item.data = nodeInfo; // should be new array, so just use it + // System.arraycopy(nodeInfo.data, nodeInfo.startOffset, + // item.data, 0, item.data.length); + item.isExternalValueReference = false; + /* + * if ( item.entryValueType == 0x1f || + * item.entryValueType == 0x1e ) + * { + * try { + * // if ( item.entryType == 0x0037 ) + * { + * String temp = new String(item.data, item.entryValueType + * == 0x1E ? "UTF8" : "UTF-16LE"); + * System.out.printf("String: 0x%04X:%04X, \"%s\"\n", + * item.entryType, item.entryValueType, temp); + * } + * } catch (UnsupportedEncodingException e) { + * e.printStackTrace(); + * } + * } + * else + * { + * + * System.out.printf("Other: 0x%04X:%04X, %d bytes\n", + * item.entryType, item.entryValueType, item.data.length); + * + * } + * / + **/ + } + break; } offset = offset + 8; @@ -198,7 +197,6 @@ public HashMap getItems() { @Override public String toString() { - if (this.isDescNotYetInitiated) { this.isDescNotYetInitiated = false; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java index da533847..de6240c1 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableBCItem.java @@ -39,7 +39,7 @@ /** * Items within the BC Table - * + * * @author Richard Johnson */ class PSTTableBCItem extends PSTTableItem { diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java index 7bb6c869..122e16f6 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTableItem.java @@ -87,7 +87,6 @@ public String getStringValue(String codepage) { * @return string value */ public String getStringValue(final int stringType, String codepage) { - if (stringType == VALUE_TYPE_PT_UNICODE) { // we are a nice little-endian unicode string. try { @@ -96,9 +95,7 @@ public String getStringValue(final int stringType, String codepage) { } return new String(this.data, "UTF-16LE").trim(); } catch (final UnsupportedEncodingException e) { - - if (PSTFile.isPrintErrors()) - System.err.println("Error decoding string: " + this.data.toString()); + if (PSTFile.isPrintErrors()) System.err.println("Error decoding string: " + this.data.toString()); return ""; } } @@ -190,14 +187,18 @@ public String toString() { try { s = new String(this.data, "UTF-16LE"); } catch (final UnsupportedEncodingException e) { - if (PSTFile.isPrintErrors()) - System.err.println("Error decoding string: " + this.data.toString()); + if (PSTFile.isPrintErrors()) System.err.println("Error decoding string: " + this.data.toString()); s = ""; } if (s.length() >= 2 && s.charAt(0) == 0x0001) { - return String.format("%s [%04X][%04X]%s", ret, (short) s.charAt(0), (short) s.charAt(1), - s.substring(2)); + return String.format( + "%s [%04X][%04X]%s", + ret, + (short) s.charAt(0), + (short) s.charAt(1), + s.substring(2) + ); } return ret + s; diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java index f77d85fa..413908bb 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTask.java @@ -69,8 +69,12 @@ public PSTTask(final PSTFile theFile, final DescriptorIndexNode descriptorIndexN * @param table the table * @param localDescriptorItems the local descriptor items */ - public PSTTask(final PSTFile theFile, final DescriptorIndexNode folderIndexNode, final PSTTableBC table, - final HashMap localDescriptorItems) { + public PSTTask( + final PSTFile theFile, + final DescriptorIndexNode folderIndexNode, + final PSTTableBC table, + final HashMap localDescriptorItems + ) { super(theFile, folderIndexNode, table, localDescriptorItems); } @@ -220,20 +224,60 @@ public int getAcceptanceState() { @Override public String toString() { - return "Status Integer 32-bit signed 0x0 => Not started [TODO]: " + this.getTaskStatus() + "\n" - + "Percent Complete Floating point double precision (64-bit): " + this.getPercentComplete() + "\n" - + "Is team task Boolean: " + this.isTeamTask() + "\n" + "Start date Filetime: " + this.getTaskStartDate() - + "\n" + "Due date Filetime: " + this.getTaskDueDate() + "\n" + "Date completed Filetime: " - + this.getTaskDateCompleted() + "\n" + "Actual effort in minutes Integer 32-bit signed: " - + this.getTaskActualEffort() + "\n" + "Total effort in minutes Integer 32-bit signed: " - + this.getTaskEstimatedEffort() + "\n" + "Task version Integer 32-bit signed FTK: Access count: " - + this.getTaskVersion() + "\n" + "Complete Boolean: " + this.isTaskComplete() + "\n" - + "Owner ASCII or Unicode string: " + this.getTaskOwner() + "\n" + "Delegator ASCII or Unicode string: " - + this.getTaskAssigner() + "\n" + "Unknown ASCII or Unicode string: " + this.getTaskLastUser() + "\n" - + "Ordinal Integer 32-bit signed: " + this.getTaskOrdinal() + "\n" + "Is recurring Boolean: " - + this.isTaskFRecurring() + "\n" + "Role ASCII or Unicode string: " + this.getTaskRole() + "\n" - + "Ownership Integer 32-bit signed: " + this.getTaskOwnership() + "\n" + "Delegation State: " - + this.getAcceptanceState(); - + return ( + "Status Integer 32-bit signed 0x0 => Not started [TODO]: " + + this.getTaskStatus() + + "\n" + + "Percent Complete Floating point double precision (64-bit): " + + this.getPercentComplete() + + "\n" + + "Is team task Boolean: " + + this.isTeamTask() + + "\n" + + "Start date Filetime: " + + this.getTaskStartDate() + + "\n" + + "Due date Filetime: " + + this.getTaskDueDate() + + "\n" + + "Date completed Filetime: " + + this.getTaskDateCompleted() + + "\n" + + "Actual effort in minutes Integer 32-bit signed: " + + this.getTaskActualEffort() + + "\n" + + "Total effort in minutes Integer 32-bit signed: " + + this.getTaskEstimatedEffort() + + "\n" + + "Task version Integer 32-bit signed FTK: Access count: " + + this.getTaskVersion() + + "\n" + + "Complete Boolean: " + + this.isTaskComplete() + + "\n" + + "Owner ASCII or Unicode string: " + + this.getTaskOwner() + + "\n" + + "Delegator ASCII or Unicode string: " + + this.getTaskAssigner() + + "\n" + + "Unknown ASCII or Unicode string: " + + this.getTaskLastUser() + + "\n" + + "Ordinal Integer 32-bit signed: " + + this.getTaskOrdinal() + + "\n" + + "Is recurring Boolean: " + + this.isTaskFRecurring() + + "\n" + + "Role ASCII or Unicode string: " + + this.getTaskRole() + + "\n" + + "Ownership Integer 32-bit signed: " + + this.getTaskOwnership() + + "\n" + + "Delegation State: " + + this.getAcceptanceState() + ); } } diff --git a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java index e5ae7d16..90b5dd59 100644 --- a/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java +++ b/javalibpst/src/main/java/fr/gouv/vitam/tools/javalibpst/PSTTimeZone.java @@ -42,7 +42,7 @@ /** * Class containing time zone information - * + * * @author Orin Eman * * @@ -68,8 +68,11 @@ public class PSTTimeZone { ruleOffset = 4 + headerLen; for (int rule = 0; rule < nRules; ++rule) { // Is this rule the effective rule? - final int flags = (int) PSTObject.convertLittleEndianBytesToLong(timeZoneData, ruleOffset + 4, - ruleOffset + 6); + final int flags = (int) PSTObject.convertLittleEndianBytesToLong( + timeZoneData, + ruleOffset + 4, + ruleOffset + 6 + ); if ((flags & 0x0002) != 0) { this.rule = new TZRule(timeZoneData, ruleOffset + 6); break; @@ -77,8 +80,7 @@ public class PSTTimeZone { ruleOffset += 66; } } catch (final Exception e) { - if (PSTFile.isPrintErrors()) - System.err.printf("Exception reading timezone: %s\n", e.toString()); + if (PSTFile.isPrintErrors()) System.err.printf("Exception reading timezone: %s\n", e.toString()); e.printStackTrace(); this.rule = null; this.name = ""; @@ -92,8 +94,7 @@ public class PSTTimeZone { try { this.rule = new TZRule(new SYSTEMTIME(), timeZoneData, 0); } catch (final Exception e) { - if (PSTFile.isPrintErrors()) - System.err.printf("Exception reading timezone: %s\n", e.toString()); + if (PSTFile.isPrintErrors()) System.err.printf("Exception reading timezone: %s\n", e.toString()); e.printStackTrace(); this.rule = null; name = ""; @@ -103,7 +104,7 @@ public class PSTTimeZone { public PSTTimeZone(String name, SimpleTimeZone simpleTimeZone) { this.name = name; this.rule = null; - this.simpleTimeZone=simpleTimeZone; + this.simpleTimeZone = simpleTimeZone; } public String getName() { @@ -117,30 +118,45 @@ public SimpleTimeZone getSimpleTimeZone() { if (this.rule.startStandard.wMonth == 0) { // A time zone with no daylight savings time - this.simpleTimeZone = new SimpleTimeZone((this.rule.lBias + this.rule.lStandardBias) * 60 * 1000, - this.name); + this.simpleTimeZone = new SimpleTimeZone( + (this.rule.lBias + this.rule.lStandardBias) * 60 * 1000, + this.name + ); return this.simpleTimeZone; } final int startMonth = (this.rule.startDaylight.wMonth - 1) + Calendar.JANUARY; - final int startDayOfMonth = (this.rule.startDaylight.wDay == 5) ? -1 + final int startDayOfMonth = (this.rule.startDaylight.wDay == 5) + ? -1 : ((this.rule.startDaylight.wDay - 1) * 7) + 1; final int startDayOfWeek = this.rule.startDaylight.wDayOfWeek + Calendar.SUNDAY; final int endMonth = (this.rule.startStandard.wMonth - 1) + Calendar.JANUARY; - final int endDayOfMonth = (this.rule.startStandard.wDay == 5) ? -1 + final int endDayOfMonth = (this.rule.startStandard.wDay == 5) + ? -1 : ((this.rule.startStandard.wDay - 1) * 7) + 1; final int endDayOfWeek = this.rule.startStandard.wDayOfWeek + Calendar.SUNDAY; final int savings = (this.rule.lStandardBias - this.rule.lDaylightBias) * 60 * 1000; - this.simpleTimeZone = new SimpleTimeZone(-((this.rule.lBias + this.rule.lStandardBias) * 60 * 1000), this.name, - startMonth, startDayOfMonth, -startDayOfWeek, - (((((this.rule.startDaylight.wHour * 60) + this.rule.startDaylight.wMinute) * 60) - + this.rule.startDaylight.wSecond) * 1000) + this.rule.startDaylight.wMilliseconds, - endMonth, endDayOfMonth, -endDayOfWeek, - (((((this.rule.startStandard.wHour * 60) + this.rule.startStandard.wMinute) * 60) - + this.rule.startStandard.wSecond) * 1000) + this.rule.startStandard.wMilliseconds, - savings); + this.simpleTimeZone = new SimpleTimeZone( + -((this.rule.lBias + this.rule.lStandardBias) * 60 * 1000), + this.name, + startMonth, + startDayOfMonth, + -startDayOfWeek, + (((((this.rule.startDaylight.wHour * 60) + this.rule.startDaylight.wMinute) * 60) + + this.rule.startDaylight.wSecond) * + 1000) + + this.rule.startDaylight.wMilliseconds, + endMonth, + endDayOfMonth, + -endDayOfWeek, + (((((this.rule.startStandard.wHour * 60) + this.rule.startStandard.wMinute) * 60) + + this.rule.startStandard.wSecond) * + 1000) + + this.rule.startStandard.wMilliseconds, + savings + ); return this.simpleTimeZone; } @@ -151,8 +167,10 @@ public boolean isEqual(final PSTTimeZone rhs) { return true; } - if (PSTFile.isPrintErrors()) - System.err.printf("Warning: different timezones with the same name: %s\n", this.name); + if (PSTFile.isPrintErrors()) System.err.printf( + "Warning: different timezones with the same name: %s\n", + this.name + ); } return false; } @@ -196,26 +214,37 @@ public class SYSTEMTIME { SYSTEMTIME(final byte[] timeZoneData, final int offset) { this.wYear = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset, offset + 2) & 0x7FFF); - this.wMonth = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 2, offset + 4) - & 0x7FFF); - this.wDayOfWeek = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 4, offset + 6) - & 0x7FFF); - this.wDay = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 6, offset + 8) - & 0x7FFF); - this.wHour = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 8, offset + 10) - & 0x7FFF); - this.wMinute = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 10, offset + 12) - & 0x7FFF); - this.wSecond = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 12, offset + 14) - & 0x7FFF); - this.wMilliseconds = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 14, - offset + 16) & 0x7FFF); + this.wMonth = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 2, offset + 4) & + 0x7FFF); + this.wDayOfWeek = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 4, offset + 6) & + 0x7FFF); + this.wDay = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 6, offset + 8) & + 0x7FFF); + this.wHour = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 8, offset + 10) & + 0x7FFF); + this.wMinute = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 10, offset + 12) & + 0x7FFF); + this.wSecond = (short) (PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 12, offset + 14) & + 0x7FFF); + this.wMilliseconds = (short) (PSTObject.convertLittleEndianBytesToLong( + timeZoneData, + offset + 14, + offset + 16 + ) & + 0x7FFF); } boolean isEqual(final SYSTEMTIME rhs) { - return this.wYear == rhs.wYear && this.wMonth == rhs.wMonth && this.wDayOfWeek == rhs.wDayOfWeek - && this.wDay == rhs.wDay && this.wHour == rhs.wHour && this.wMinute == rhs.wMinute - && this.wSecond == rhs.wSecond && this.wMilliseconds == rhs.wMilliseconds; + return ( + this.wYear == rhs.wYear && + this.wMonth == rhs.wMonth && + this.wDayOfWeek == rhs.wDayOfWeek && + this.wDay == rhs.wDay && + this.wHour == rhs.wHour && + this.wMinute == rhs.wMinute && + this.wSecond == rhs.wSecond && + this.wMilliseconds == rhs.wMilliseconds + ); } public short wYear; @@ -239,12 +268,18 @@ private class TZRule { this.dtStart = dtStart; this.InitBiases(timeZoneData, offset); @SuppressWarnings("unused") - final short wStandardYear = (short) PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 12, - offset + 14); + final short wStandardYear = (short) PSTObject.convertLittleEndianBytesToLong( + timeZoneData, + offset + 12, + offset + 14 + ); this.startStandard = new SYSTEMTIME(timeZoneData, offset + 14); @SuppressWarnings("unused") - final short wDaylightYear = (short) PSTObject.convertLittleEndianBytesToLong(timeZoneData, offset + 30, - offset + 32); + final short wDaylightYear = (short) PSTObject.convertLittleEndianBytesToLong( + timeZoneData, + offset + 30, + offset + 32 + ); this.startDaylight = new SYSTEMTIME(timeZoneData, offset + 32); } @@ -262,9 +297,14 @@ private void InitBiases(final byte[] timeZoneData, final int offset) { } boolean isEqual(final TZRule rhs) { - return this.dtStart.isEqual(rhs.dtStart) && this.lBias == rhs.lBias - && this.lStandardBias == rhs.lStandardBias && this.lDaylightBias == rhs.lDaylightBias - && this.startStandard.isEqual(rhs.startStandard) && this.startDaylight.isEqual(rhs.startDaylight); + return ( + this.dtStart.isEqual(rhs.dtStart) && + this.lBias == rhs.lBias && + this.lStandardBias == rhs.lStandardBias && + this.lDaylightBias == rhs.lDaylightBias && + this.startStandard.isEqual(rhs.startStandard) && + this.startDaylight.isEqual(rhs.startDaylight) + ); } SYSTEMTIME dtStart; diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java index 161c60dc..06f4c902 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/AppointmentTest.java @@ -61,47 +61,34 @@ public class AppointmentTest { * Test we can access appointments from the PST. */ @Test - public final void testGetDistList() - throws PSTException, IOException, URISyntaxException { + public final void testGetDistList() throws PSTException, IOException, URISyntaxException { URL dirUrl = ClassLoader.getSystemResource("dist-list.pst"); PSTFile pstFile = new PSTFile(new File(dirUrl.toURI())); PSTAppointment appt = (PSTAppointment) PSTObject.detectAndLoadPSTObject(pstFile, 2097348); PSTAppointmentRecurrence r = new PSTAppointmentRecurrence( - appt.getRecurrenceStructure(), appt, appt.getRecurrenceTimeZone()); + appt.getRecurrenceStructure(), + appt, + appt.getRecurrenceTimeZone() + ); + Assert.assertEquals("Has 3 deleted items (1 removed, 2 changed)", 3, r.getDeletedInstanceDates().length); - Assert.assertEquals( - "Has 3 deleted items (1 removed, 2 changed)", - 3, - r.getDeletedInstanceDates().length); - - Assert.assertEquals( - "Number of Exceptions", - 2, - r.getExceptionCount()); + Assert.assertEquals("Number of Exceptions", 2, r.getExceptionCount()); String d = r.getException(0).getDescription().trim(); Assert.assertEquals("correct app desc", "This is the appointment at 9", d); LocalDateTime ldt = LocalDateTime.ofInstant( - r.getException(0).getStartDate().toInstant(), - ZoneId.of("US/Pacific")); - Assert.assertEquals( - "First exception correct hour", - 9, - ldt.getHour()); + r.getException(0).getStartDate().toInstant(), + ZoneId.of("US/Pacific") + ); + Assert.assertEquals("First exception correct hour", 9, ldt.getHour()); d = r.getException(1).getDescription().trim(); Assert.assertEquals("correct app desc", "This is the one at 10", d); - ldt = LocalDateTime.ofInstant( - r.getException(1).getStartDate().toInstant(), - ZoneId.of("US/Pacific")); - Assert.assertEquals( - "Second exception correct hour", - 10, - ldt.getHour()); - + ldt = LocalDateTime.ofInstant(r.getException(1).getStartDate().toInstant(), ZoneId.of("US/Pacific")); + Assert.assertEquals("Second exception correct hour", 10, ldt.getHour()); //System.out.println(r.getExceptionCount()); //System.out.println(r.getException(0).getDTStamp()); @@ -110,4 +97,3 @@ public final void testGetDistList() //} } } - diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java index e075f635..ddc2e167 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/DistListTest.java @@ -37,16 +37,17 @@ */ package fr.gouv.vitam.tools.javalibpst; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; -import java.util.HashSet; import java.util.Arrays; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import java.util.HashSet; /** * Tests for {@link PSTDistList}. @@ -60,11 +61,10 @@ public class DistListTest { * Test we can retrieve distribution lists from the PST. */ @Test - public final void testGetDistList() - throws PSTException, IOException, URISyntaxException { + public final void testGetDistList() throws PSTException, IOException, URISyntaxException { URL dirUrl = ClassLoader.getSystemResource("dist-list.pst"); PSTFile pstFile = new PSTFile(new File(dirUrl.toURI())); - PSTDistList obj = (PSTDistList)PSTObject.detectAndLoadPSTObject(pstFile, 2097188); + PSTDistList obj = (PSTDistList) PSTObject.detectAndLoadPSTObject(pstFile, 2097188); Object[] members = obj.getDistributionListMembers(); Assert.assertEquals("Correct number of members", members.length, 3); int numberOfContacts = 0; @@ -73,28 +73,30 @@ public final void testGetDistList() HashSet displayNames = new HashSet(); for (Object member : members) { if (member instanceof PSTContact) { - PSTContact contact = (PSTContact)member; - Assert.assertEquals("Contact email address", - contact.getEmail1EmailAddress(), - "contact1@rjohnson.id.au"); + PSTContact contact = (PSTContact) member; + Assert.assertEquals( + "Contact email address", + contact.getEmail1EmailAddress(), + "contact1@rjohnson.id.au" + ); numberOfContacts++; } else { - PSTDistList.OneOffEntry entry = (PSTDistList.OneOffEntry)member; + PSTDistList.OneOffEntry entry = (PSTDistList.OneOffEntry) member; emailAddresses.add(entry.getEmailAddress()); displayNames.add(entry.getDisplayName()); numberOfOneOffRecords++; } } Assert.assertEquals("Correct number of members", members.length, 3); - Assert.assertEquals("Contains all display names", - displayNames, - new HashSet(Arrays.asList( - new String[] {"dist name 2", - "dist name 1"}))); - Assert.assertEquals("Contains all email addresses", - emailAddresses, - new HashSet(Arrays.asList( - new String[] {"dist1@rjohnson.id.au", - "dist2@rjohnson.id.au"}))); + Assert.assertEquals( + "Contains all display names", + displayNames, + new HashSet(Arrays.asList(new String[] { "dist name 2", "dist name 1" })) + ); + Assert.assertEquals( + "Contains all email addresses", + emailAddresses, + new HashSet(Arrays.asList(new String[] { "dist1@rjohnson.id.au", "dist2@rjohnson.id.au" })) + ); } } diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java index 2fa3da1f..9dac2df9 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTFileContentTest.java @@ -37,7 +37,6 @@ */ package fr.gouv.vitam.tools.javalibpst; - import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -46,7 +45,9 @@ @RunWith(JUnit4.class) public class PSTFileContentTest { + static class TestPSTFileContent extends PSTFileContent { + int position = 0; @Override @@ -77,9 +78,7 @@ public byte readByte() throws IOException { } @Override - public void close() throws IOException { - - } + public void close() throws IOException {} } @Test @@ -88,4 +87,4 @@ public void testReadCompletely() throws IOException { pstFileContent.readCompletely(new byte[10]); } -} \ No newline at end of file +} diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java index a8945b30..4a33add6 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PSTGlobalObjectIdTest.java @@ -37,10 +37,10 @@ */ package fr.gouv.vitam.tools.javalibpst; -import java.util.Date; - import org.junit.Test; +import java.util.Date; + import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; @@ -49,92 +49,291 @@ */ public class PSTGlobalObjectIdTest { - @Test - public void unpackValid() { -// Global Object ID: -// Byte Array ID = cb: 16 lpb: 040000008200E00074C5B7101A82E008 -// Year: 0x0000 = 0 -// Month: 0x00 = 0 = 0x0 -// Day: 0x00 = 0 -// Creation Time = 0x01D04F6F:0xA226A470 = 01:50:07.415 PM 23/02/2015 -// X: 0x00000000:0x00000000 -// Size: 0x10 = 16 -// Data = cb: 16 lpb: 086DFAD3919FD44089199898CDCF4DC2 - byte[] objectId = { - 0x04, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0xE0, 0x00, 0x74, (byte) 0xC5, (byte) 0xB7, 0x10, 0x1A, (byte) 0x82, (byte) 0xE0, 0x08, // Byte Array ID - 0x07, // Year Hi - (byte) 0xde, // Year Low - 0x0b, // Month - 0x14, // Day - 0x70, (byte) 0xA4, 0x26, (byte) 0xA2, 0x6F, 0x4F, (byte) 0xD0, 0x01, // Creation Time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // X - 0x10, 0x00, 0x00, 0x00, // Size - 0x08, 0x6D, (byte) 0xFA, (byte) 0xD3, (byte) 0x91, (byte) 0x9F, (byte) 0xD4, 0x40, (byte) 0x89, 0x19, (byte) 0x98, (byte) 0x98, (byte) 0xCD, (byte) 0xCF, 0x4D, (byte) 0xC2 // Data - }; + @Test + public void unpackValid() { + // Global Object ID: + // Byte Array ID = cb: 16 lpb: 040000008200E00074C5B7101A82E008 + // Year: 0x0000 = 0 + // Month: 0x00 = 0 = 0x0 + // Day: 0x00 = 0 + // Creation Time = 0x01D04F6F:0xA226A470 = 01:50:07.415 PM 23/02/2015 + // X: 0x00000000:0x00000000 + // Size: 0x10 = 16 + // Data = cb: 16 lpb: 086DFAD3919FD44089199898CDCF4DC2 + byte[] objectId = { + 0x04, + 0x00, + 0x00, + 0x00, + (byte) 0x82, + 0x00, + (byte) 0xE0, + 0x00, + 0x74, + (byte) 0xC5, + (byte) 0xB7, + 0x10, + 0x1A, + (byte) 0x82, + (byte) 0xE0, + 0x08, // Byte Array ID + 0x07, // Year Hi + (byte) 0xde, // Year Low + 0x0b, // Month + 0x14, // Day + 0x70, + (byte) 0xA4, + 0x26, + (byte) 0xA2, + 0x6F, + 0x4F, + (byte) 0xD0, + 0x01, // Creation Time + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, // X + 0x10, + 0x00, + 0x00, + 0x00, // Size + 0x08, + 0x6D, + (byte) 0xFA, + (byte) 0xD3, + (byte) 0x91, + (byte) 0x9F, + (byte) 0xD4, + 0x40, + (byte) 0x89, + 0x19, + (byte) 0x98, + (byte) 0x98, + (byte) 0xCD, + (byte) 0xCF, + 0x4D, + (byte) 0xC2, // Data + }; - PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); + PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); - assertThat("Validate YearHi is correct", object.getYearLow(), equalTo(0x00DE)); - assertThat("Validate YearLow is correct", object.getYearHigh(), equalTo(0x7)); - assertThat("Validate Year is correct", object.getYear(), equalTo(2014)); - assertThat("Validate Day is correct", object.getDay(), equalTo(20)); - assertThat("Validate Month is correct", object.getMonth(), equalTo(11)); - assertThat("Validate CreationTimeLow is correct", object.getCreationTimeLow(), equalTo(0xA226A470)); - assertThat("Validate CreationTimeHigh is correct", object.getCreationTimeHigh(), equalTo(0x01D04F6F)); - assertThat("Validate CreationTime is correct", object.getCreationTime().getTime(), equalTo(new Date(1424699407415L).getTime())); - assertThat("Validate Size is correct", object.getDataSize(), equalTo(16)); - assertThat("Validate Size of date matches actual data size", object.getData().length, equalTo(object.getDataSize())); - assertThat("Validate Date is correct", PSTGlobalObjectId.bytesToHex(object.getData()), equalTo("086DFAD3919FD44089199898CDCF4DC2")); - } + assertThat("Validate YearHi is correct", object.getYearLow(), equalTo(0x00DE)); + assertThat("Validate YearLow is correct", object.getYearHigh(), equalTo(0x7)); + assertThat("Validate Year is correct", object.getYear(), equalTo(2014)); + assertThat("Validate Day is correct", object.getDay(), equalTo(20)); + assertThat("Validate Month is correct", object.getMonth(), equalTo(11)); + assertThat("Validate CreationTimeLow is correct", object.getCreationTimeLow(), equalTo(0xA226A470)); + assertThat("Validate CreationTimeHigh is correct", object.getCreationTimeHigh(), equalTo(0x01D04F6F)); + assertThat( + "Validate CreationTime is correct", + object.getCreationTime().getTime(), + equalTo(new Date(1424699407415L).getTime()) + ); + assertThat("Validate Size is correct", object.getDataSize(), equalTo(16)); + assertThat( + "Validate Size of date matches actual data size", + object.getData().length, + equalTo(object.getDataSize()) + ); + assertThat( + "Validate Date is correct", + PSTGlobalObjectId.bytesToHex(object.getData()), + equalTo("086DFAD3919FD44089199898CDCF4DC2") + ); + } - @Test(expected = AssertionError.class) - public void unpackWithInvalidIdSignature() { - byte[] objectId = { - 0x04, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0xE0, 0x00, 0x74, (byte) 0xC5, (byte) 0xB7, 0x10, 0x1A, (byte) 0x82, (byte) 0xE0, 0x00, // Byte Array ID (last byte 00 rather then 08 - 0x07, // Year Hi - (byte) 0xde, // Year Low - 0x0b, // Month - 0x14, // Day - 0x70, (byte) 0xA4, 0x26, (byte) 0xA2, 0x6F, 0x4F, (byte) 0xD0, 0x01, // Creation Time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // X - 0x10, 0x00, 0x00, 0x00, // Size - 0x08, 0x6D, (byte) 0xFA, (byte) 0xD3, (byte) 0x91, (byte) 0x9F, (byte) 0xD4, 0x40, (byte) 0x89, 0x19, (byte) 0x98, (byte) 0x98, (byte) 0xCD, (byte) 0xCF, 0x4D, (byte) 0xC2 // Data - }; + @Test(expected = AssertionError.class) + public void unpackWithInvalidIdSignature() { + byte[] objectId = { + 0x04, + 0x00, + 0x00, + 0x00, + (byte) 0x82, + 0x00, + (byte) 0xE0, + 0x00, + 0x74, + (byte) 0xC5, + (byte) 0xB7, + 0x10, + 0x1A, + (byte) 0x82, + (byte) 0xE0, + 0x00, // Byte Array ID (last byte 00 rather then 08 + 0x07, // Year Hi + (byte) 0xde, // Year Low + 0x0b, // Month + 0x14, // Day + 0x70, + (byte) 0xA4, + 0x26, + (byte) 0xA2, + 0x6F, + 0x4F, + (byte) 0xD0, + 0x01, // Creation Time + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, // X + 0x10, + 0x00, + 0x00, + 0x00, // Size + 0x08, + 0x6D, + (byte) 0xFA, + (byte) 0xD3, + (byte) 0x91, + (byte) 0x9F, + (byte) 0xD4, + 0x40, + (byte) 0x89, + 0x19, + (byte) 0x98, + (byte) 0x98, + (byte) 0xCD, + (byte) 0xCF, + 0x4D, + (byte) 0xC2, // Data + }; - PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); - } + PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); + } - @Test(expected = AssertionError.class) - public void unpackWithInvalidIdData() { - byte[] objectId = { - 0x04, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0xE0, 0x00, 0x74, (byte) 0xC5, (byte) 0xB7, 0x10, 0x1A, (byte) 0x82, (byte) 0xE0, 0x08, // Byte Array ID - 0x07, // Year Hi - (byte) 0xde, // Year Low - 0x0b, // Month - 0x14, // Day - 0x70, (byte) 0xA4, 0x26, (byte) 0xA2, 0x6F, 0x4F, (byte) 0xD0, 0x01, // Creation Time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // X - 0x10, 0x00, 0x00, 0x00, // Size - 0x08, 0x6D, (byte) 0xFA, (byte) 0xD3, (byte) 0x91, (byte) 0x9F, (byte) 0xD4, 0x40, (byte) 0x89, 0x19, (byte) 0x98, (byte) 0x98, (byte) 0xCD, (byte) 0xCF, 0x4D // Data (missing last byte) - }; + @Test(expected = AssertionError.class) + public void unpackWithInvalidIdData() { + byte[] objectId = { + 0x04, + 0x00, + 0x00, + 0x00, + (byte) 0x82, + 0x00, + (byte) 0xE0, + 0x00, + 0x74, + (byte) 0xC5, + (byte) 0xB7, + 0x10, + 0x1A, + (byte) 0x82, + (byte) 0xE0, + 0x08, // Byte Array ID + 0x07, // Year Hi + (byte) 0xde, // Year Low + 0x0b, // Month + 0x14, // Day + 0x70, + (byte) 0xA4, + 0x26, + (byte) 0xA2, + 0x6F, + 0x4F, + (byte) 0xD0, + 0x01, // Creation Time + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, // X + 0x10, + 0x00, + 0x00, + 0x00, // Size + 0x08, + 0x6D, + (byte) 0xFA, + (byte) 0xD3, + (byte) 0x91, + (byte) 0x9F, + (byte) 0xD4, + 0x40, + (byte) 0x89, + 0x19, + (byte) 0x98, + (byte) 0x98, + (byte) 0xCD, + (byte) 0xCF, + 0x4D, // Data (missing last byte) + }; - PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); - } + PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); + } - @Test(expected = AssertionError.class) - public void unpackWithInvalidIdDataLength() { - byte[] objectId = { - 0x04, 0x00, 0x00, 0x00, (byte) 0x82, 0x00, (byte) 0xE0, 0x00, 0x74, (byte) 0xC5, (byte) 0xB7, 0x10, 0x1A, (byte) 0x82, (byte) 0xE0, 0x08, // Byte Array ID - 0x07, // Year Hi - (byte) 0xde, // Year Low - 0x0b, // Month - 0x14, // Day - 0x70, (byte) 0xA4, 0x26, (byte) 0xA2, 0x6F, 0x4F, (byte) 0xD0, 0x01, // Creation Time - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // X - 0x10, 0x10, 0x00, 0x00, // Size - 0x08, 0x6D, (byte) 0xFA, (byte) 0xD3, (byte) 0x91, (byte) 0x9F, (byte) 0xD4, 0x40, (byte) 0x89, 0x19, (byte) 0x98, (byte) 0x98, (byte) 0xCD, (byte) 0xCF, 0x4D, (byte) 0xC2 // Data - }; + @Test(expected = AssertionError.class) + public void unpackWithInvalidIdDataLength() { + byte[] objectId = { + 0x04, + 0x00, + 0x00, + 0x00, + (byte) 0x82, + 0x00, + (byte) 0xE0, + 0x00, + 0x74, + (byte) 0xC5, + (byte) 0xB7, + 0x10, + 0x1A, + (byte) 0x82, + (byte) 0xE0, + 0x08, // Byte Array ID + 0x07, // Year Hi + (byte) 0xde, // Year Low + 0x0b, // Month + 0x14, // Day + 0x70, + (byte) 0xA4, + 0x26, + (byte) 0xA2, + 0x6F, + 0x4F, + (byte) 0xD0, + 0x01, // Creation Time + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, // X + 0x10, + 0x10, + 0x00, + 0x00, // Size + 0x08, + 0x6D, + (byte) 0xFA, + (byte) 0xD3, + (byte) 0x91, + (byte) 0x9F, + (byte) 0xD4, + 0x40, + (byte) 0x89, + 0x19, + (byte) 0x98, + (byte) 0x98, + (byte) 0xCD, + (byte) 0xCF, + 0x4D, + (byte) 0xC2, // Data + }; - PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); - } + PSTGlobalObjectId object = new PSTGlobalObjectId(objectId); + } } diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java index 9e6bf584..55a4ba27 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/PasswordTest.java @@ -37,17 +37,16 @@ */ package fr.gouv.vitam.tools.javalibpst; -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.HashSet; -import java.util.Arrays; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; + /** * Tests for {@link PSTDistList}. * @@ -60,25 +59,19 @@ public class PasswordTest { * Test for password protectedness. */ @Test - public final void testPasswordProtected() - throws PSTException, IOException, URISyntaxException { + public final void testPasswordProtected() throws PSTException, IOException, URISyntaxException { URL dirUrl = ClassLoader.getSystemResource("passworded.pst"); PSTFile pstFile = new PSTFile(new File(dirUrl.toURI())); - Assert.assertEquals("Is password protected", - pstFile.getMessageStore().isPasswordProtected(), - true); + Assert.assertEquals("Is password protected", pstFile.getMessageStore().isPasswordProtected(), true); } /** * Test for non-password protectedness. */ @Test - public final void testNotPasswordProtected() - throws PSTException, IOException, URISyntaxException { + public final void testNotPasswordProtected() throws PSTException, IOException, URISyntaxException { URL dirUrl = ClassLoader.getSystemResource("dist-list.pst"); PSTFile pstFile = new PSTFile(new File(dirUrl.toURI())); - Assert.assertEquals("Is password protected", - pstFile.getMessageStore().isPasswordProtected(), - false); + Assert.assertEquals("Is password protected", pstFile.getMessageStore().isPasswordProtected(), false); } } diff --git a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java index be755cdc..b7d12312 100644 --- a/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java +++ b/javalibpst/src/test/java/fr/gouv/vitam/tools/javalibpst/Version36Test.java @@ -37,41 +37,39 @@ */ package fr.gouv.vitam.tools.javalibpst; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.util.*; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class Version36Test { @Test - public final void testVersion36() - throws PSTException, IOException, URISyntaxException { + public final void testVersion36() throws PSTException, IOException, URISyntaxException { URL dirUrl = ClassLoader.getSystemResource("example-2013.ost"); PSTFile pstFile2 = new PSTFile(new File(dirUrl.toURI())); - PSTFolder inbox = (PSTFolder)PSTObject.detectAndLoadPSTObject(pstFile2, 8578); + PSTFolder inbox = (PSTFolder) PSTObject.detectAndLoadPSTObject(pstFile2, 8578); + Assert.assertEquals("Number of emails in folder", inbox.getContentCount(), 2); + PSTMessage msg = (PSTMessage) PSTObject.detectAndLoadPSTObject(pstFile2, 2097284); Assert.assertEquals( - "Number of emails in folder", - inbox.getContentCount(), - 2); - PSTMessage msg = (PSTMessage)PSTObject.detectAndLoadPSTObject(pstFile2, 2097284); - Assert.assertEquals( - "correct email text.", - "This is an e-mail message sent automatically by Microsoft " - + "Outlook while testing the settings for your account.", - msg.getBodyHTML().trim()); + "correct email text.", + "This is an e-mail message sent automatically by Microsoft " + + "Outlook while testing the settings for your account.", + msg.getBodyHTML().trim() + ); //processFolder(pstFile2.getRootFolder()); } int depth = -1; - public void processFolder(PSTFolder folder) - throws PSTException, IOException { + + public void processFolder(PSTFolder folder) throws PSTException, IOException { depth++; // the root folder doesn't have a display name if (depth > 0) { @@ -90,11 +88,11 @@ public void processFolder(PSTFolder folder) // and now the emails for this folder if (folder.getContentCount() > 0) { depth++; - PSTMessage email = (PSTMessage)folder.getNextChild(); + PSTMessage email = (PSTMessage) folder.getNextChild(); while (email != null) { printDepth(); - System.out.println("Email: "+ email.getDescriptorNodeId() + " - " + email.getSubject()); - email = (PSTMessage)folder.getNextChild(); + System.out.println("Email: " + email.getDescriptorNodeId() + " - " + email.getSubject()); + email = (PSTMessage) folder.getNextChild(); } depth--; } @@ -102,7 +100,7 @@ public void processFolder(PSTFolder folder) } public void printDepth() { - for (int x = 0; x < depth-1; x++) { + for (int x = 0; x < depth - 1; x++) { System.out.print(" | "); } System.out.print(" |- "); diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java index 478a7148..5ddf4da7 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractApp.java @@ -115,97 +115,141 @@ private static Options createOptions() { Option help = new Option("h", "help", false, "help"); options.addOption(help); - Option type = new Option("t", "type", true, - "type of local container to extract (thunderbird|pst|eml|mbox|msg) or protocol for server access (imap|imaps|pop3...) [default pst]"); + Option type = new Option( + "t", + "type", + true, + "type of local container to extract (thunderbird|pst|eml|mbox|msg) or protocol for server access (imap|imaps|pop3...) [default pst]" + ); options.addOption(type); - Option user = new Option("u", "username", true, - "user account name (also used for destination extraction naming)"); + Option user = new Option( + "u", + "username", + true, + "user account name (also used for destination extraction naming)" + ); options.addOption(user); - Option password = new Option("p", "password", true, - "password"); + Option password = new Option("p", "password", true, "password"); options.addOption(password); - Option server = new Option("s", "server", true, - "mail server [HostName|IP](:port)"); + Option server = new Option("s", "server", true, "mail server [HostName|IP](:port)"); options.addOption(server); - Option container = new Option("c", "container", true, - "local container directory or file to extract"); + Option container = new Option("c", "container", true, "local container directory or file to extract"); options.addOption(container); Option folder = new Option("f", "folder", true, "specific mail folder to extract [default root]"); options.addOption(folder); - Option rootpath = new Option("r", "rootpath", true, - "path for output directory [default current directory]"); + Option rootpath = new Option("r", "rootpath", true, "path for output directory [default current directory]"); options.addOption(rootpath); - Option outputname = new Option("o", "outputname", true, - "name for output [default no name, extraction in rootpath directly, and log file is .log]"); + Option outputname = new Option( + "o", + "outputname", + true, + "name for output [default no name, extraction in rootpath directly, and log file is .log]" + ); options.addOption(outputname); - Option dropemptyfolders = new Option("d", "dropemptyfolders [default false]", false, - "drop empty folders"); + Option dropemptyfolders = new Option("d", "dropemptyfolders [default false]", false, "drop empty folders"); options.addOption(dropemptyfolders); - Option keeponlydeep = new Option("k", "keeponlydeep [default false]", false, - "keep only empty folders not at root level"); + Option keeponlydeep = new Option( + "k", + "keeponlydeep [default false]", + false, + "keep only empty folders not at root level" + ); options.addOption(keeponlydeep); - Option nameslength = new Option("n", "nameslength", true, - "length limit for directories and files generated names [default 12]"); + Option nameslength = new Option( + "n", + "nameslength", + true, + "length limit for directories and files generated names [default 12]" + ); options.addOption(nameslength); - Option setchar = new Option("cs", "charset", true, - "used charset in extraction [default UTF-8]"); + Option setchar = new Option("cs", "charset", true, "used charset in extraction [default UTF-8]"); options.addOption(setchar); - Option extractchoices = new Option("e", "extractchoices", true, - "which elements are extracted with m for mails, c for contacts and a for appointment [default mca]"); + Option extractchoices = new Option( + "e", + "extractchoices", + true, + "which elements are extracted with m for mails, c for contacts and a for appointment [default mca]" + ); options.addOption(extractchoices); - Option extractmode = new Option("ml", "extractmode", true, - "which form of extraction with c for content and l for lists [default cl]"); + Option extractmode = new Option( + "ml", + "extractmode", + true, + "which form of extraction with c for content and l for lists [default cl]" + ); options.addOption(extractmode); - Option extracttextmetadata = new Option("tm", "extracttextmetadata", true, - "extract text and add to metadata with m for message and a for attachments [default nothing]"); + Option extracttextmetadata = new Option( + "tm", + "extracttextmetadata", + true, + "extract text and add to metadata with m for message and a for attachments [default nothing]" + ); options.addOption(extracttextmetadata); - Option extracttextfile = new Option("tf", "extracttextfile", true, - "extract text and add a text file with m for message and a for attachments [default nothing]"); + Option extracttextfile = new Option( + "tf", + "extracttextfile", + true, + "extract text and add a text file with m for message and a for attachments [default nothing]" + ); options.addOption(extracttextfile); - Option model = new Option("model", "model", true, - "model of metadata extraction on disk 1 or 2 (default 2)"); + Option model = new Option("model", "model", true, "model of metadata extraction on disk 1 or 2 (default 2)"); options.addOption(model); - Option warning = new Option("w", "warning", false, - "generate warning when there's a problem on a message whatever log level except OFF (otherwise log only at MESSAGE_DETAILS level) [default false]"); + Option warning = new Option( + "w", + "warning", + false, + "generate warning when there's a problem on a message whatever log level except OFF (otherwise log only at MESSAGE_DETAILS level) [default false]" + ); options.addOption(warning); Option debug = new Option("b", "debug", false, "activate debug log [default false]"); options.addOption(debug); - Option verbatim = new Option("v", "verbatim", true, - "event level to log (OFF|GLOBAL|WARNING|FOLDER|MESSAGE_GROUP|MESSAGE|MESSAGE_DETAILS) [default OFF]"); + Option verbatim = new Option( + "v", + "verbatim", + true, + "event level to log (OFF|GLOBAL|WARNING|FOLDER|MESSAGE_GROUP|MESSAGE|MESSAGE_DETAILS) [default OFF]" + ); options.addOption(verbatim); - Option english = new Option("u", "english", true, - "english version GUI"); + Option english = new Option("u", "english", true, "english version GUI"); options.addOption(english); Option extract = new Option("x", "doextract", false, "extract all informations action"); options.addOption(extract); - Option list = new Option("l", "dolist", false, - "process all informations and list folders action (no drop options)"); + Option list = new Option( + "l", + "dolist", + false, + "process all informations and list folders action (no drop options)" + ); options.addOption(list); - Option stats = new Option("z", "dostats", false, - "process all informations and list folders and there statistics action (no drop options)"); + Option stats = new Option( + "z", + "dostats", + false, + "process all informations and list folders and there statistics action (no drop options)" + ); options.addOption(stats); return options; @@ -221,8 +265,8 @@ private static Options createOptions() { * @throws UnsupportedLookAndFeelException the unsupported look and feel * exception */ - public static void main(String[] args) throws ClassNotFoundException, InstantiationException, - IllegalAccessException, UnsupportedLookAndFeelException { + public static void main(String[] args) + throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); // params @@ -236,7 +280,7 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat String charset; String extractChoices, extractMode, extractTextMetadata, extractTextFile; int model; - boolean warning , debug ; + boolean warning, debug; String verbatim; boolean english; @@ -251,7 +295,8 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat HelpFormatter formatter = new HelpFormatter(); // Texte personnalisé pour l'introduction - String header = "Mail extraction application (pst|thundebird|mbox|eml|msg files and distant mail servers)\n\nOptions :"; + String header = + "Mail extraction application (pst|thundebird|mbox|eml|msg files and distant mail servers)\n\nOptions :"; // Texte personnalisé pour la conclusion String footer = "\nwhen no x, l or z action is given the GUI is launched"; @@ -260,17 +305,14 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat formatter.printHelp("MailExtract", header, options, footer); System.exit(0); } - } catch (ParseException e) { System.out.println("Can't analyze options : " + e.getMessage()); System.exit(1); } // get all options and arguments verifying them when possible - if (cmd.hasOption("type")) - type = noNullString(cmd.getOptionValue("type")); - else - type = "pst"; + if (cmd.hasOption("type")) type = noNullString(cmd.getOptionValue("type")); + else type = "pst"; user = noNullString(cmd.getOptionValue("user")); @@ -279,26 +321,22 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat String server = cmd.getOptionValue("server"); hostname = ""; port = -1; - if (server != null) - try { - if (server.indexOf(':') >= 0) { - hostname = server.substring(0, server.indexOf(':')); - port = Integer.parseInt(server.substring(server.indexOf(':') + 1)); - } else - hostname = server; - } catch (NumberFormatException e) { - System.out.println("Wrong server format must be "); - System.exit(1); - } + if (server != null) try { + if (server.indexOf(':') >= 0) { + hostname = server.substring(0, server.indexOf(':')); + port = Integer.parseInt(server.substring(server.indexOf(':') + 1)); + } else hostname = server; + } catch (NumberFormatException e) { + System.out.println("Wrong server format must be "); + System.exit(1); + } container = noNullString(cmd.getOptionValue("container")); folder = noNullString(cmd.getOptionValue("folder")); - if (cmd.hasOption("rootpath")) - rootPath = noNullString(cmd.getOptionValue("rootpath")); - else - rootPath = System.getProperty("user.dir"); + if (cmd.hasOption("rootpath")) rootPath = noNullString(cmd.getOptionValue("rootpath")); + else rootPath = System.getProperty("user.dir"); outputName = noNullString(cmd.getOptionValue("outputname")); @@ -319,56 +357,57 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat if (cmd.hasOption("charset")) { charset = noNullString(cmd.getOptionValue("charset")); try { - if (!Charset.isSupported(charset)) - throw new IllegalCharsetNameException(charset); + if (!Charset.isSupported(charset)) throw new IllegalCharsetNameException(charset); } catch (IllegalCharsetNameException e) { System.err.println("The specified charset '" + charset + "' is not supported."); System.exit(1); } - } else - charset = "UTF-8"; + } else charset = "UTF-8"; if (cmd.hasOption("extractchoices")) { extractChoices = noNullString(cmd.getOptionValue("extractchoices")); if (!extractChoices.matches("^[mca]{0,3}$")) { - System.err.println("The 'extractchoices' argument must only contain the letters 'm', 'c', and 'a', each at most once and in any order."); + System.err.println( + "The 'extractchoices' argument must only contain the letters 'm', 'c', and 'a', each at most once and in any order." + ); System.exit(1); } - } else - extractChoices = "mca"; + } else extractChoices = "mca"; if (cmd.hasOption("extractmode")) { extractMode = noNullString(cmd.getOptionValue("extractmode")); if (!extractMode.matches("^[cl]{0,2}$")) { - System.err.println("The 'extractmode' argument must only contain the letters 'c' and 'l', each at most once and in any order."); + System.err.println( + "The 'extractmode' argument must only contain the letters 'c' and 'l', each at most once and in any order." + ); System.exit(1); } - } else - extractMode = "cl"; + } else extractMode = "cl"; if (cmd.hasOption("extracttextmetadata")) { extractTextMetadata = noNullString(cmd.getOptionValue("extracttextmetadata")); if (!extractTextMetadata.matches("^[ma]{0,2}$")) { - System.err.println("The 'extracttextmetadata' argument must only contain the letters 'm' and 'a', each at most once and in any order."); + System.err.println( + "The 'extracttextmetadata' argument must only contain the letters 'm' and 'a', each at most once and in any order." + ); System.exit(1); } - } else - extractTextMetadata = ""; + } else extractTextMetadata = ""; if (cmd.hasOption("extracttextfile")) { extractTextFile = noNullString(cmd.getOptionValue("extracttextfile")); if (!extractTextFile.matches("^[ma]{0,2}$")) { - System.err.println("The 'extracttextfile' argument must only contain the letters 'm' and 'a', each at most once and in any order."); + System.err.println( + "The 'extracttextfile' argument must only contain the letters 'm' and 'a', each at most once and in any order." + ); System.exit(1); } - } else - extractTextFile = ""; + } else extractTextFile = ""; model = 2; if (cmd.hasOption("model")) { try { model = Integer.parseInt((String) cmd.getOptionValue("model")); - } catch (NumberFormatException e) { System.err.println("The model argument must be numeric"); System.exit(1); @@ -389,7 +428,9 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat try { MailExtractLogger.getLevel(verbatim); } catch (MailExtractException iae) { - System.err.println("Unknown log level must be in the list (OFF|GLOBAL|WARNING|FOLDER|MESSAGE_GROUP|MESSAGE|MESSAGE_DETAILS)"); + System.err.println( + "Unknown log level must be in the list (OFF|GLOBAL|WARNING|FOLDER|MESSAGE_GROUP|MESSAGE|MESSAGE_DETAILS)" + ); System.exit(1); } } @@ -398,22 +439,22 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat // get store extractor options StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( - keepFirstLevelEmptyFolders, - dropEmptyFolders, - warning, - namesLength, - charset, - extractChoices.contains("m"), // extract messages - extractChoices.contains("c"), // extract contacts - extractChoices.contains("a"), // extract appointments - extractMode.contains("c"), // extract elements content - extractMode.contains("l"), // extract elements list - extractTextFile.contains("m"), // extract message text file - extractTextMetadata.contains("m"), // extract message text metadata - extractTextFile.contains("a"), // extract file text file - extractTextMetadata.contains("a"), // extract file text metadata - model); - + keepFirstLevelEmptyFolders, + dropEmptyFolders, + warning, + namesLength, + charset, + extractChoices.contains("m"), // extract messages + extractChoices.contains("c"), // extract contacts + extractChoices.contains("a"), // extract appointments + extractMode.contains("c"), // extract elements content + extractMode.contains("l"), // extract elements list + extractTextFile.contains("m"), // extract message text file + extractTextMetadata.contains("m"), // extract message text metadata + extractTextFile.contains("a"), // extract file text file + extractTextMetadata.contains("a"), // extract file text metadata + model + ); // init default store extractors // Prevent running external tools during apache-tika text extraction (tesseract, ffmpeg...). @@ -421,9 +462,21 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat // if no do option graphic version if (!cmd.hasOption("l") && !cmd.hasOption("z") && !cmd.hasOption("x")) { - new MailExtractGraphicApp(type, user, password, hostname, port, container, folder, - rootPath, outputName, - storeExtractorOptions, debug, verbatim, english); + new MailExtractGraphicApp( + type, + user, + password, + hostname, + port, + container, + folder, + rootPath, + outputName, + storeExtractorOptions, + debug, + verbatim, + english + ); } else { // specific option parsing for local type extraction switch (type) { @@ -463,13 +516,21 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat MailExtractLogger mel = null; MailExtractProgressLogger mepl = null; try { - mel = new MailExtractLogger(rootPath + File.separator + outputName + ".log", MailExtractLogger.getLevel(verbatim)); + mel = new MailExtractLogger( + rootPath + File.separator + outputName + ".log", + MailExtractLogger.getLevel(verbatim) + ); mepl = new MailExtractProgressLogger(mel.getProgressLogger(), MailExtractLogger.getLevel(verbatim)); mepl.setDebugFlag(debug); String urlString = StoreExtractor.composeStoreURL(type, server, user, password, container); - storeExtractor = StoreExtractor.createStoreExtractor(urlString, folder, - Paths.get(rootPath, outputName).toString(), storeExtractorOptions, mepl); + storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + folder, + Paths.get(rootPath, outputName).toString(), + storeExtractorOptions, + mepl + ); if (cmd.hasOption("l") || cmd.hasOption("z")) { storeExtractor.listAllFolders(cmd.hasOption("z")); } else { @@ -488,23 +549,22 @@ public static void main(String[] args) throws ClassNotFoundException, Instantiat // try if possible to log in the store extractor logger all the information // about the fatal error - private final static void logFatalError(Exception e, StoreExtractor storeExtractor, MailExtractLogger logger) { - if (logger == null) - logger = MailExtractLogger.getGlobalLogger(); + private static final void logFatalError(Exception e, StoreExtractor storeExtractor, MailExtractLogger logger) { + if (logger == null) logger = MailExtractLogger.getGlobalLogger(); logger.log(GLOBAL, "Terminated with unrecoverable error"); - if (!e.getMessage().isEmpty()) - logger.log(GLOBAL, e.getMessage()); + if (!e.getMessage().isEmpty()) logger.log(GLOBAL, e.getMessage()); logger.log(GLOBAL, getPrintStackTrace(e)); - if (storeExtractor == null - || storeExtractor.getElementCounter(StoreFolder.class, false) + storeExtractor.getElementCounter(StoreMessage.class, false) == 0) - logger.log(GLOBAL, "No writing done"); - else - logger.log(GLOBAL, "Partial extraction done in " + storeExtractor.getSummary()); - + if ( + storeExtractor == null || + storeExtractor.getElementCounter(StoreFolder.class, false) + + storeExtractor.getElementCounter(StoreMessage.class, false) == + 0 + ) logger.log(GLOBAL, "No writing done"); + else logger.log(GLOBAL, "Partial extraction done in " + storeExtractor.getSummary()); } // make a String from the stack trace - private final static String getPrintStackTrace(Exception e) { + private static final String getPrintStackTrace(Exception e) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter p = new PrintWriter(baos); @@ -512,5 +572,4 @@ private final static String getPrintStackTrace(Exception e) { p.close(); return baos.toString(); } - } diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java index 4ad85cac..c7f227be 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractException.java @@ -92,8 +92,12 @@ public MailExtractException(String message, Throwable cause) { * @param enableSuppression the enable suppression * @param writableStackTrace the writable stack trace */ - public MailExtractException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + public MailExtractException( + String message, + Throwable cause, + boolean enableSuppression, + boolean writableStackTrace + ) { super(message, cause, enableSuppression, writableStackTrace); } - } diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java index 934ea278..e79ffda1 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractGraphicApp.java @@ -63,9 +63,9 @@ public class MailExtractGraphicApp implements ActionListener, Runnable { int port; private String container, folder; private String rootpath, outputname; - + StoreExtractorOptions storeExtractorOptions; - + private boolean debug = false; private String verbatim; private boolean english; @@ -87,9 +87,21 @@ public class MailExtractGraphicApp implements ActionListener, Runnable { * @param verbatim the verbosity level for logging * @param english the flag indicating if English language is used */ - MailExtractGraphicApp(String type, String user, String password, String hostname, int port, String container, String folder, - String rootpath, String outputname, StoreExtractorOptions storeExtractorOptions, - boolean debug, String verbatim, boolean english) { + MailExtractGraphicApp( + String type, + String user, + String password, + String hostname, + int port, + String container, + String folder, + String rootpath, + String outputname, + StoreExtractorOptions storeExtractorOptions, + boolean debug, + String verbatim, + boolean english + ) { this.type = type; this.user = user; this.password = password; @@ -249,20 +261,14 @@ public void actionPerformed(ActionEvent e) { mainWindow.passwordField.setEnabled(true); } else if (command.equals("container")) { String filename = selectPath(mainWindow.containerField.getText(), false); - if (filename != null) - mainWindow.containerField.setText(filename); + if (filename != null) mainWindow.containerField.setText(filename); } else if (command.equals("savedir")) { String dirname = selectPath(mainWindow.savedirField.getText(), true); - if (dirname != null) - mainWindow.savedirField.setText(dirname); - } else if (command.equals("list")) - doAction(LIST_ACTION); - else if (command.equals("stat")) - doAction(STAT_ACTION); - else if (command.equals("extract")) - doAction(EXTRACT_ACTION); - else if (command.equals("empty")) - doAction(EMPTY_LOG); + if (dirname != null) mainWindow.savedirField.setText(dirname); + } else if (command.equals("list")) doAction(LIST_ACTION); + else if (command.equals("stat")) doAction(STAT_ACTION); + else if (command.equals("extract")) doAction(EXTRACT_ACTION); + else if (command.equals("empty")) doAction(EMPTY_LOG); } // get a file and/or directory from a standard selection dialog @@ -271,19 +277,18 @@ private String selectPath(String folder, boolean dirBool) { File file; JFileChooser fileChooser = new JFileChooser(); - fileChooser - .setFileSelectionMode((dirBool ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_AND_DIRECTORIES)); + fileChooser.setFileSelectionMode( + (dirBool ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_AND_DIRECTORIES) + ); fileChooser.setFileHidingEnabled(false); file = new File(folder); - if (file.exists()) - fileChooser.setSelectedFile(file); + if (file.exists()) fileChooser.setSelectedFile(file); int returnVal = fileChooser.showOpenDialog(this.mainWindow); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); return (file.getAbsolutePath()); - } else - return null; + } else return null; } /** @@ -312,44 +317,49 @@ private void doAction(int actionNumber) { if (actionNumber == EMPTY_LOG) { mainWindow.consoleTextArea.setText(""); - } else - new MailExtractThread(mainWindow, actionNumber, type, hostname, port, user, password, container, folder, rootpath, - outputname, storeExtractorOptions, verbatim, debug).start(); + } else new MailExtractThread( + mainWindow, + actionNumber, + type, + hostname, + port, + user, + password, + container, + folder, + rootpath, + outputname, + storeExtractorOptions, + verbatim, + debug + ).start(); } /** * The loglevel strings. */ - String[] loglevelStrings = {"OFF", "GLOBAL", "WARNING", "FOLDER", "MESSAGE_GROUP", "MESSAGE", "MESSAGE_DETAILS"}; + String[] loglevelStrings = { "OFF", "GLOBAL", "WARNING", "FOLDER", "MESSAGE_GROUP", "MESSAGE", "MESSAGE_DETAILS" }; // get the global parameters from the graphic fields private void parseParams() { // local if (mainWindow.localRadioButton.isSelected()) { - if (mainWindow.thunderbirdRadioButton.isSelected()) - type = "thunderbird"; - else if (mainWindow.emlRadioButton.isSelected()) - type = "eml"; - else if (mainWindow.msgRadioButton.isSelected()) - type = "msg"; - else if (mainWindow.mboxRadioButton.isSelected()) - type = "mbox"; - else if (mainWindow.pstRadioButton.isSelected()) - type = "pst"; + if (mainWindow.thunderbirdRadioButton.isSelected()) type = "thunderbird"; + else if (mainWindow.emlRadioButton.isSelected()) type = "eml"; + else if (mainWindow.msgRadioButton.isSelected()) type = "msg"; + else if (mainWindow.mboxRadioButton.isSelected()) type = "mbox"; + else if (mainWindow.pstRadioButton.isSelected()) type = "pst"; container = mainWindow.containerField.getText(); } // server else { - if (mainWindow.imapsRadioButton.isSelected()) - type = "imaps"; - else - type = "imap"; + if (mainWindow.imapsRadioButton.isSelected()) type = "imaps"; + else type = "imap"; String server = mainWindow.serverField.getText(); if (server.indexOf(':') >= 0) { hostname = server.substring(0, server.indexOf(':')); port = Integer.parseInt(server.substring(server.indexOf(':') + 1)); - } else - hostname = server; + } else hostname = server; user = mainWindow.userField.getText(); password = mainWindow.passwordField.getText(); } diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java index 796b5369..f0531a62 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractLogger.java @@ -67,7 +67,6 @@ public class MailExtractLogger { public static final int MESSAGE_DETAILS = 60; public static final Marker MESSAGE_DETAILS_MARKER = MarkerFactory.getMarker("MESSAGE_DETAILS"); - /** * The global logger. */ @@ -89,8 +88,10 @@ public class MailExtractLogger { * @return the app logger */ public static MailExtractLogger getGlobalLogger() { - if (globalLogger == null) - globalLogger = new MailExtractLogger(LoggerFactory.getLogger(MailExtractApp.class.getSimpleName()), GLOBAL); + if (globalLogger == null) globalLogger = new MailExtractLogger( + LoggerFactory.getLogger(MailExtractApp.class.getSimpleName()), + GLOBAL + ); return globalLogger; } @@ -104,11 +105,13 @@ public MailExtractLogger(String logPath, int progressLogLevel) { PatternLayoutEncoder consoleEncoder = new PatternLayoutEncoder(); consoleEncoder.setContext(logCtx); - consoleEncoder.setPattern("%d{HH:mm:ss.SSS} [" + MailExtractApp.class.getSimpleName() + "] %-5level %marker - %msg%n"); - if (System.getProperty("os.name").toLowerCase().contains("win")) - consoleEncoder.setCharset(Charset.forName("cp850")); - else - consoleEncoder.setCharset(Charset.forName("UTF-8")); + consoleEncoder.setPattern( + "%d{HH:mm:ss.SSS} [" + MailExtractApp.class.getSimpleName() + "] %-5level %marker - %msg%n" + ); + if (System.getProperty("os.name").toLowerCase().contains("win")) consoleEncoder.setCharset( + Charset.forName("cp850") + ); + else consoleEncoder.setCharset(Charset.forName("UTF-8")); consoleEncoder.start(); ConsoleAppender logConsoleAppender = new ConsoleAppender<>(); @@ -119,11 +122,15 @@ public MailExtractLogger(String logPath, int progressLogLevel) { PatternLayoutEncoder fileEncoder = new PatternLayoutEncoder(); fileEncoder.setContext(logCtx); - fileEncoder.setPattern("%d{HH:mm:ss.SSS} [" + MailExtractApp.class.getSimpleName() + "] %-5level %marker - %msg%n"); + fileEncoder.setPattern( + "%d{HH:mm:ss.SSS} [" + MailExtractApp.class.getSimpleName() + "] %-5level %marker - %msg%n" + ); fileEncoder.setCharset(Charset.forName("UTF-8")); fileEncoder.start(); - FileAppender logFileAppender = new FileAppender(); + FileAppender logFileAppender = new FileAppender< + ch.qos.logback.classic.spi.ILoggingEvent + >(); logFileAppender.setContext(logCtx); logFileAppender.setName("logFile"); logFileAppender.setEncoder(fileEncoder); @@ -142,20 +149,13 @@ public MailExtractLogger(String logPath, int progressLogLevel) { } public static int getLevel(String levelName) throws MailExtractException { - if (levelName.equals("OFF")) - return -1; - else if (levelName.equals(GLOBAL_MARKER.getName())) - return GLOBAL; - else if (levelName.equals(WARNING_MARKER.getName())) - return WARNING; - else if (levelName.equals(FOLDER_MARKER.getName())) - return FOLDER; - else if (levelName.equals(MESSAGE_GROUP_MARKER.getName())) - return MESSAGE_GROUP; - else if (levelName.equals(MESSAGE_MARKER.getName())) - return MESSAGE; - else if (levelName.equals(MESSAGE_DETAILS_MARKER.getName())) - return MESSAGE_DETAILS; + if (levelName.equals("OFF")) return -1; + else if (levelName.equals(GLOBAL_MARKER.getName())) return GLOBAL; + else if (levelName.equals(WARNING_MARKER.getName())) return WARNING; + else if (levelName.equals(FOLDER_MARKER.getName())) return FOLDER; + else if (levelName.equals(MESSAGE_GROUP_MARKER.getName())) return MESSAGE_GROUP; + else if (levelName.equals(MESSAGE_MARKER.getName())) return MESSAGE; + else if (levelName.equals(MESSAGE_DETAILS_MARKER.getName())) return MESSAGE_DETAILS; throw new MailExtractException("Unknown log level"); } @@ -180,10 +180,8 @@ public static Marker getMarker(int level) { public void log(int level, String message) { if (level <= progressLogLevel) { if (logger != null) { - if (level >= GLOBAL) - logger.info(getMarker(level), message); + if (level >= GLOBAL) logger.info(getMarker(level), message); else logger.error(message); - } } } @@ -197,8 +195,8 @@ public int getProgressLogLevel() { } public void close() { - if (logger instanceof ch.qos.logback.classic.Logger) - ((ch.qos.logback.classic.Logger) logger).detachAndStopAllAppenders(); + if ( + logger instanceof ch.qos.logback.classic.Logger + ) ((ch.qos.logback.classic.Logger) logger).detachAndStopAllAppenders(); } - } diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java index ae86765d..1efd2b5c 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractMainWindow.java @@ -250,7 +250,6 @@ public class MailExtractMainWindow extends JFrame { */ JCheckBox debugCheckBox; - /** * The english check box. */ @@ -259,9 +258,7 @@ public class MailExtractMainWindow extends JFrame { /** * Other labels */ - JLabel lblExtractElementsLabel, - lblExtractTextLabel, lblExtractTextToFileLabel, lblExtractTextToMetadataLabel, loglevelLabel, - namesLengthLabel, savedirLabel, folderLabel, charsetLabel; + JLabel lblExtractElementsLabel, lblExtractTextLabel, lblExtractTextToFileLabel, lblExtractTextToMetadataLabel, loglevelLabel, namesLengthLabel, savedirLabel, folderLabel, charsetLabel; /** * Other buttons @@ -276,11 +273,44 @@ public class MailExtractMainWindow extends JFrame { /** * The proposed charsets. */ - String[] charsetGraphicStrings = {"windows-1252", "ISO-8859-1", "UTF-8", "CESU-8", "IBM00858", "IBM437", "IBM775", - "IBM850", "IBM852", "IBM855", "IBM857", "IBM862", "IBM866", "ISO-8859-2", "ISO-8859-4", "ISO-8859-5", - "ISO-8859-7", "ISO-8859-9", "ISO-8859-13", "ISO-8859-15", "KOI8-R", "KOI8-U", "US-ASCII", "UTF-16", - "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE", "x-UTF-32BE-BOM", "x-UTF-32LE-BOM", - "windows-1250", "windows-1251", "windows-1253", "windows-1254", "windows-1257"}; + String[] charsetGraphicStrings = { + "windows-1252", + "ISO-8859-1", + "UTF-8", + "CESU-8", + "IBM00858", + "IBM437", + "IBM775", + "IBM850", + "IBM852", + "IBM855", + "IBM857", + "IBM862", + "IBM866", + "ISO-8859-2", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-7", + "ISO-8859-9", + "ISO-8859-13", + "ISO-8859-15", + "KOI8-R", + "KOI8-U", + "US-ASCII", + "UTF-16", + "UTF-16BE", + "UTF-16LE", + "UTF-32", + "UTF-32BE", + "UTF-32LE", + "x-UTF-32BE-BOM", + "x-UTF-32LE-BOM", + "windows-1250", + "windows-1251", + "windows-1253", + "windows-1254", + "windows-1257", + }; private JPanel panel; @@ -311,7 +341,7 @@ public MailExtractMainWindow(MailExtractGraphicApp app) { } // Initialize the contents of the frame. - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) private void initialize() { URL imageURL = getClass().getClassLoader().getResource("VitamIcon96.png"); if (imageURL != null) { @@ -325,8 +355,8 @@ private void initialize() { setBounds(0, 0, 800, 800); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.columnWeights = new double[]{1.0, 1, 1, 1}; - gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + gridBagLayout.columnWeights = new double[] { 1.0, 1, 1, 1 }; + gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; getContentPane().setLayout(gridBagLayout); // Panel de condition d'extraction @@ -342,8 +372,8 @@ private void initialize() { gbc_extractChoicePanel.gridy = 9; getContentPane().add(extractChoicePanel, gbc_extractChoicePanel); GridBagLayout gbl_extractChoicePanel = new GridBagLayout(); - gbl_extractChoicePanel.rowWeights = new double[]{1.0, 1.0}; - gbl_extractChoicePanel.columnWeights = new double[]{1.0, 1, 1}; + gbl_extractChoicePanel.rowWeights = new double[] { 1.0, 1.0 }; + gbl_extractChoicePanel.columnWeights = new double[] { 1.0, 1, 1 }; extractChoicePanel.setLayout(gbl_extractChoicePanel); lblExtractElementsLabel = new JLabel(MESSAGES.getString("label.extractElements")); @@ -390,7 +420,6 @@ private void initialize() { gbc_extractListsCheckBox.gridy = 1; extractChoicePanel.add(extractListCheckBox, gbc_extractListsCheckBox); - // Panel d'extraction du texte JPanel extractTextPanel = new JPanel(); extractTextPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); @@ -404,8 +433,8 @@ private void initialize() { gbc_extractTextPanel.gridy = 10; getContentPane().add(extractTextPanel, gbc_extractTextPanel); GridBagLayout gbl_extractTextPanel = new GridBagLayout(); - gbl_extractTextPanel.rowWeights = new double[]{1.0, 1.0}; - gbl_extractTextPanel.columnWeights = new double[]{1.0, 1, 1}; + gbl_extractTextPanel.rowWeights = new double[] { 1.0, 1.0 }; + gbl_extractTextPanel.columnWeights = new double[] { 1.0, 1, 1 }; extractTextPanel.setLayout(gbl_extractTextPanel); lblExtractTextLabel = new JLabel(MESSAGES.getString("label.extractText")); @@ -927,11 +956,10 @@ private void initialize() { private void SetLabels(ResourceBundle messages) { setTitle(messages.getString("mainWindow.title")); - int index=loglevelComboBox.getSelectedIndex(); + int index = loglevelComboBox.getSelectedIndex(); DefaultComboBoxModel model = (DefaultComboBoxModel) loglevelComboBox.getModel(); model.removeAllElements(); - for (int i = 0; i < 7; i++) - model.addElement(messages.getString("log." + i)); + for (int i = 0; i < 7; i++) model.addElement(messages.getString("log." + i)); loglevelComboBox.setSelectedIndex(index); lblExtractElementsLabel.setText(messages.getString("label.extractElements")); diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java index 020d73ae..3f474b93 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/MailExtractThread.java @@ -105,17 +105,41 @@ public class MailExtractThread extends Thread { * @param logLevel the log level * @param debugFlag the debug flag */ - public MailExtractThread(MailExtractMainWindow mainWindow, int actionNumber, String protocol, String host, int port, String user, String password, - String container, String folder, String destRootPath, String destName, - StoreExtractorOptions storeExtractorOptions, String logLevel, boolean debugFlag) { + public MailExtractThread( + MailExtractMainWindow mainWindow, + int actionNumber, + String protocol, + String host, + int port, + String user, + String password, + String container, + String folder, + String destRootPath, + String destName, + StoreExtractorOptions storeExtractorOptions, + String logLevel, + boolean debugFlag + ) { this.mainWindow = mainWindow; try { - mel = new MailExtractLogger(destRootPath + File.separator + destName + ".log", MailExtractLogger.getLevel(logLevel)); - logger = new MailExtractProgressLogger(mel.getProgressLogger(), MailExtractLogger.getLevel(logLevel), (count, log) -> { - String newLog = mainWindow.consoleTextArea.getText() + "\n" + log; - mainWindow.consoleTextArea.setText(newLog); - mainWindow.consoleTextArea.setCaretPosition(newLog.length()); - }, 1000,2,MailExtractProgressLogger.MESSAGE_GROUP,1000); + mel = new MailExtractLogger( + destRootPath + File.separator + destName + ".log", + MailExtractLogger.getLevel(logLevel) + ); + logger = new MailExtractProgressLogger( + mel.getProgressLogger(), + MailExtractLogger.getLevel(logLevel), + (count, log) -> { + String newLog = mainWindow.consoleTextArea.getText() + "\n" + log; + mainWindow.consoleTextArea.setText(newLog); + mainWindow.consoleTextArea.setCaretPosition(newLog.length()); + }, + 1000, + 2, + MailExtractProgressLogger.MESSAGE_GROUP, + 1000 + ); logger.setDebugFlag(debugFlag); } catch (Exception e) { System.out.println(e.getMessage()); @@ -124,8 +148,13 @@ public MailExtractThread(MailExtractMainWindow mainWindow, int actionNumber, Str // do the job, creating a store extractor and running the extraction try { String urlString = StoreExtractor.composeStoreURL(protocol, host, user, password, container); - this.storeExtractor = StoreExtractor.createStoreExtractor(urlString, folder, - Paths.get(destRootPath, destName).toString(), storeExtractorOptions, logger); + this.storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + folder, + Paths.get(destRootPath, destName).toString(), + storeExtractorOptions, + logger + ); this.actionNumber = actionNumber; } catch (MailExtractLibException ee) { doProgressLogWithoutInterruption(logger, GLOBAL, "mailextract: erreur d'extraction", ee); @@ -150,12 +179,9 @@ public void run() { storeExtractor.listAllFolders(true); break; case MailExtractGraphicApp.EXTRACT_ACTION: - if (storeExtractor.hasDestName()) - storeExtractor.extractAllFolders(); - else - throw new MailExtractLibException("mailextract: no destination name for extraction", null); + if (storeExtractor.hasDestName()) storeExtractor.extractAllFolders(); + else throw new MailExtractLibException("mailextract: no destination name for extraction", null); break; - } } catch (MailExtractLibException ee) { doProgressLogWithoutInterruption(logger, GLOBAL, "mailextract: extraction error", ee); @@ -166,20 +192,17 @@ public void run() { System.out.println(getPrintStackTrace(e)); } finally { try { - if (storeExtractor != null) - storeExtractor.endStoreExtractor(); + if (storeExtractor != null) storeExtractor.endStoreExtractor(); } catch (MailExtractLibException e) { doProgressLogWithoutInterruption(logger, GLOBAL, "mailextract: closing error", e); } - if (logger != null) - logger.close(); - if (mel != null) - mel.close(); + if (logger != null) logger.close(); + if (mel != null) mel.close(); } } // make a String from the stack trace - private final static String getPrintStackTrace(Exception e) { + private static final String getPrintStackTrace(Exception e) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter p = new PrintWriter(baos); @@ -187,5 +210,4 @@ private final static String getPrintStackTrace(Exception e) { p.close(); return baos.toString(); } - } diff --git a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java index fd790ee8..8eed570d 100644 --- a/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java +++ b/mailextract/src/main/java/fr/gouv/vitam/tools/mailextract/package-info.java @@ -38,4 +38,4 @@ /** * Provides the class for the simple command and graphic application. */ -package fr.gouv.vitam.tools.mailextract; \ No newline at end of file +package fr.gouv.vitam.tools.mailextract; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java index 7843ce69..dfefd4aa 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/EmbeddedStoreExtractor.java @@ -41,7 +41,6 @@ * The Interface EmbeddedStoreExtractor. */ public interface EmbeddedStoreExtractor { - /** * Gets the attachment in which is the embedded object. * diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java index 9cb924ab..d96f6917 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAppointment.java @@ -104,7 +104,14 @@ public abstract class StoreAppointment extends StoreElement { * Human-readable text for the statuses defined in {@link #MESSAGE_STATUS_UNKNOWN}, * {@link #MESSAGE_STATUS_LOCAL}, etc. */ - public static final String[] MESSAGE_STATUS_TEXT = {"Unknown", "Local", "Request", "Resp.Yes", "Resp.May", "Resp.No"}; + public static final String[] MESSAGE_STATUS_TEXT = { + "Unknown", + "Local", + "Request", + "Resp.Yes", + "Resp.May", + "Resp.No", + }; /** * A unique identifier for the appointment (used to differentiate it from other elements). @@ -223,10 +230,8 @@ protected StoreAppointment(StoreFolder storeFolder) { @Override public String getLogDescription() { String result = "appointment " + listLineId; - if (subject != null) - result += " [" + subject + "/"; - else - result += " [no subject/"; + if (subject != null) result += " [" + subject + "/"; + else result += " [no subject/"; result += getDateInDefinedTimeZone(startTime) + " - " + getDateInDefinedTimeZone(endTime) + "]"; return result; } @@ -260,10 +265,12 @@ public static String getElementName() { */ public static void printGlobalListCSVHeader(PrintStream ps) { synchronized (ps) { - ps.println("ID;Subject;Location;From;ToAttendees;CcAttendees;StartTime;EndTime;" + - "MiscNotes;uniqID;SequenceNumber;ModificationTime;Folder;MessageStatus;" + - "isRecurrent;RecurrencePattern;StartRecurrenceTime;EndRecurrenceTime;" + - "ExceptionFromId;ExceptionDate;isDeletion;hasAttachment"); + ps.println( + "ID;Subject;Location;From;ToAttendees;CcAttendees;StartTime;EndTime;" + + "MiscNotes;uniqID;SequenceNumber;ModificationTime;Folder;MessageStatus;" + + "isRecurrent;RecurrencePattern;StartRecurrenceTime;EndRecurrenceTime;" + + "ExceptionFromId;ExceptionDate;isDeletion;hasAttachment" + ); } } @@ -275,44 +282,49 @@ public static void printGlobalListCSVHeader(PrintStream ps) { * @throws InterruptedException the interrupted exception * @throws MailExtractLibException the mail extract lib exception */ - public void extractAppointment(boolean writeFlag, StoreAppointment father) throws InterruptedException, MailExtractLibException { + public void extractAppointment(boolean writeFlag, StoreAppointment father) + throws InterruptedException, MailExtractLibException { if (writeFlag) { - if (storeFolder.getStoreExtractor().getOptions().extractElementsList) - writeToAppointmentsList(father); + if (storeFolder.getStoreExtractor().getOptions().extractElementsList) writeToAppointmentsList(father); if (storeFolder.getStoreExtractor().getOptions().extractElementsContent) { if ((attachments != null) && (!attachments.isEmpty())) { - ArchiveUnit attachmentNode = new ArchiveUnit(storeFolder.storeExtractor, storeFolder.storeExtractor.destRootPath + - File.separator + storeFolder.storeExtractor.destName + File.separator + "appointments", "AppointmentAttachments#" + listLineId); + ArchiveUnit attachmentNode = new ArchiveUnit( + storeFolder.storeExtractor, + storeFolder.storeExtractor.destRootPath + + File.separator + + storeFolder.storeExtractor.destName + + File.separator + + "appointments", + "AppointmentAttachments#" + listLineId + ); attachmentNode.addMetadata("DescriptionLevel", "RecordGrp", true); attachmentNode.addMetadata("Title", "Appointment Attachments #" + listLineId, true); - attachmentNode.addMetadata("Description", "Appointment attachments extracted for " + subject + "[" + startTime + "-" + endTime + "]", true); + attachmentNode.addMetadata( + "Description", + "Appointment attachments extracted for " + subject + "[" + startTime + "-" + endTime + "]", + true + ); attachmentNode.addMetadata("StartDate", getDateInUTCTimeZone(startTime), true); attachmentNode.addMetadata("EndDate", getDateInUTCTimeZone(endTime), true); attachmentNode.write(); StoreAttachment.extractAttachments(attachments, attachmentNode, writeFlag); } } - if (exceptions != null) - for (StoreAppointment a : exceptions) - a.extractAppointment(writeFlag, this); + if (exceptions != null) for (StoreAppointment a : exceptions) a.extractAppointment(writeFlag, this); } } private String getDateInUTCTimeZone(ZonedDateTime date) { String result; - if (date != null) - result = date.withZoneSameInstant(ZoneId.of("UTC")).format(ISO_8601); - else - result = ""; + if (date != null) result = date.withZoneSameInstant(ZoneId.of("UTC")).format(ISO_8601); + else result = ""; return result; } private String getDateInDefinedTimeZone(ZonedDateTime date) { String result; - if (date != null) - result = date.format(ISO_8601); - else - result = ""; + if (date != null) result = date.format(ISO_8601); + else result = ""; return result; } @@ -359,7 +371,10 @@ private void writeToAppointmentsList(StoreAppointment father) { ps.format("\"%s\";", (father != null ? father.listLineId : "")); ps.format("\"%s\";", getDateInDefinedTimeZone(exceptionDate)); ps.format("\"%s\";", (isRecurrenceDeletion ? "X" : "")); - ps.format("\"%s\"", ((attachments != null) && (!attachments.isEmpty()) ? Integer.toString(attachments.size()) : "")); + ps.format( + "\"%s\"", + ((attachments != null) && (!attachments.isEmpty()) ? Integer.toString(attachments.size()) : "") + ); ps.println(""); ps.flush(); } @@ -380,8 +395,7 @@ public void listElement(boolean statsFlag) throws InterruptedException, MailExtr if (storeFolder.getStoreExtractor().getOptions().extractAppointments) { listLineId = storeFolder.getStoreExtractor().incElementCounter(this.getClass()); analyzeAppointment(); - if (statsFlag) - extractAppointment(false, null); + if (statsFlag) extractAppointment(false, null); } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java index 2498677e..5effd4d8 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreAttachment.java @@ -42,7 +42,6 @@ import fr.gouv.vitam.tools.mailextractlib.utils.DateRange; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; - import jakarta.activation.MimeType; import jakarta.activation.MimeTypeParseException; @@ -132,8 +131,17 @@ public class StoreAttachment { * @param contentID Mime multipart content ID useful for inline * @param attachmentType Type of attachment (inline, simple file, another store...) */ - public StoreAttachment(StoreElement fatherElement, Object storeContent, String attachmentStoreScheme, String name, Date creationDate, - Date modificationDate, String mimeType, String contentID, int attachmentType) { + public StoreAttachment( + StoreElement fatherElement, + Object storeContent, + String attachmentStoreScheme, + String name, + Date creationDate, + Date modificationDate, + String mimeType, + String contentID, + int attachmentType + ) { this.fatherElement = fatherElement; this.attachmentContent = storeContent; this.attachmentStoreScheme = attachmentStoreScheme; @@ -152,10 +160,8 @@ public StoreAttachment(StoreElement fatherElement, Object storeContent, String a * @throws MailExtractLibException the extraction exception */ public byte[] getRawAttachmentContent() throws MailExtractLibException { - if (attachmentContent instanceof byte[]) - return (byte[]) attachmentContent; - else - throw new MailExtractLibException("mailextractlib: this attachment has no binary form", null); + if (attachmentContent instanceof byte[]) return (byte[]) attachmentContent; + else throw new MailExtractLibException("mailextractlib: this attachment has no binary form", null); } /** @@ -215,10 +221,8 @@ public void setMimeType(String mimeType) { this.mimeType = mimeType; } catch (MimeTypeParseException e) { int i = mimeType.lastIndexOf('/'); - if ((i != -1) && (i < mimeType.length())) - this.mimeType = "application/" + mimeType.substring(i + 1); - else - this.mimeType = "application/octet-stream"; + if ((i != -1) && (i < mimeType.length())) this.mimeType = "application/" + mimeType.substring(i + 1); + else this.mimeType = "application/octet-stream"; } } @@ -244,21 +248,22 @@ public void setStoreScheme(String scheme) { * * @param attachments the attachments */ - static protected void detectStoreAttachments(List attachments) { + protected static void detectStoreAttachments(List attachments) { String mimeType; if (attachments != null && !attachments.isEmpty()) { for (StoreAttachment a : attachments) { - if ((a.attachmentType != StoreAttachment.STORE_ATTACHMENT) - && (a.attachmentContent instanceof byte[]) - // special case for ms-tnef attachments "winmail.dat" because tika can identify them as rfc822 - // when part of it is mail - && (!a.mimeType.toLowerCase().equals("application/ms-tnef") - && (!a.mimeType.toLowerCase().equals("application/vnd.ms-tnef")))) { + if ( + (a.attachmentType != StoreAttachment.STORE_ATTACHMENT) && + (a.attachmentContent instanceof byte[]) && + // special case for ms-tnef attachments "winmail.dat" because tika can identify them as rfc822 + // when part of it is mail + (!a.mimeType.toLowerCase().equals("application/ms-tnef") && + (!a.mimeType.toLowerCase().equals("application/vnd.ms-tnef"))) + ) { try { mimeType = TikaExtractor.getInstance().getMimeType(a.getRawAttachmentContent()); - if (mimeType == null) - continue; + if (mimeType == null) continue; for (String mt : StoreExtractor.mimeTypeSchemeMap.keySet()) { if (mimeType.equals(mt)) { a.setStoreScheme(StoreExtractor.mimeTypeSchemeMap.get(mt)); @@ -284,17 +289,29 @@ static protected void detectStoreAttachments(List attachments) * @throws MailExtractLibException the mail extract lib exception * @throws InterruptedException the interrupted exception */ - static public void extractAttachments(List attachments, ArchiveUnit messageNode, boolean writeFlag) - throws MailExtractLibException, InterruptedException { + public static void extractAttachments( + List attachments, + ArchiveUnit messageNode, + boolean writeFlag + ) throws MailExtractLibException, InterruptedException { if (attachments != null) { for (StoreAttachment a : attachments) { // message identification if (a.attachmentType == StoreAttachment.STORE_ATTACHMENT) { // recursive extraction of a message in attachment... - doProgressLog(a.fatherElement.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: attached message extraction", null); - if (a.extractAsStoreAttachment(messageNode, writeFlag)) - continue; - doProgressLog(a.fatherElement.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: can't extract as an attached message, extract as standard attachment", null); + doProgressLog( + a.fatherElement.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: attached message extraction", + null + ); + if (a.extractAsStoreAttachment(messageNode, writeFlag)) continue; + doProgressLog( + a.fatherElement.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: can't extract as an attached message, extract as standard attachment", + null + ); } // standard attachment file a.extractAsFileOrInlineAttachment(messageNode, writeFlag); @@ -305,12 +322,12 @@ static public void extractAttachments(List attachments, Archive /** * Extract a file or inline message attachment. */ - private void extractAsFileOrInlineAttachment(ArchiveUnit node, boolean writeFlag) throws MailExtractLibException, InterruptedException { + private void extractAsFileOrInlineAttachment(ArchiveUnit node, boolean writeFlag) + throws MailExtractLibException, InterruptedException { ArchiveUnit attachmentNode; StoreExtractor fatherExtractor = fatherElement.getStoreExtractor(); - if ((name == null) || name.isEmpty()) - name = "[Vide]"; + if ((name == null) || name.isEmpty()) name = "[Vide]"; attachmentNode = new ArchiveUnit(fatherExtractor, node, "Attachment", name); attachmentNode.addMetadata("DescriptionLevel", "Item", true); attachmentNode.addMetadata("Title", name, true); @@ -321,84 +338,120 @@ private void extractAsFileOrInlineAttachment(ArchiveUnit node, boolean writeFlag // (max for correcting a current confusion between theese two dates) Date date = null; if (creationDate != null) { - if (modificationDate != null) - date = (creationDate.compareTo(modificationDate) > 0 ? creationDate - : modificationDate); - else - date = creationDate; - } else if (modificationDate != null) - date = modificationDate; - if (date != null) - attachmentNode.addMetadata("CreatedDate", DateRange.getISODateString(creationDate), true); + if (modificationDate != null) date = (creationDate.compareTo(modificationDate) > 0 + ? creationDate + : modificationDate); + else date = creationDate; + } else if (modificationDate != null) date = modificationDate; + if (date != null) attachmentNode.addMetadata("CreatedDate", DateRange.getISODateString(creationDate), true); // Raw object extraction - if (name.endsWith(".lnk")) - name=name+".txt"; // break windows shortcuts + if (name.endsWith(".lnk")) name = name + ".txt"; // break windows shortcuts attachmentNode.addObject(getRawAttachmentContent(), name, "BinaryMaster", 1); // Text object extraction String textExtract = null; - if (fatherExtractor.options.extractFileTextFile || fatherExtractor.options.extractFileTextMetadata) - try { - textExtract = TikaExtractor.getInstance().extractTextFromBinary(getRawAttachmentContent()); - } catch (MailExtractLibException ee) { - doProgressLog(fatherExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, - "mailextractlib: can't extract text content from attachment " + name, ee); - } + if (fatherExtractor.options.extractFileTextFile || fatherExtractor.options.extractFileTextMetadata) try { + textExtract = TikaExtractor.getInstance().extractTextFromBinary(getRawAttachmentContent()); + } catch (MailExtractLibException ee) { + doProgressLog( + fatherExtractor.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: can't extract text content from attachment " + name, + ee + ); + } // put in file if (fatherExtractor.options.extractFileTextFile && (!((textExtract == null) || textExtract.trim().isEmpty()))) { attachmentNode.addObject(textExtract.getBytes(StandardCharsets.UTF_8), name + ".txt", "TextContent", 1); } // put in metadata - if (fatherExtractor.options.extractFileTextMetadata - && (!((textExtract == null) || textExtract.isEmpty()))) { + if (fatherExtractor.options.extractFileTextMetadata && (!((textExtract == null) || textExtract.isEmpty()))) { attachmentNode.addLongMetadata("TextContent", textExtract, true); } - if (writeFlag) - attachmentNode.write(); + if (writeFlag) attachmentNode.write(); } /** * Extract a store attachment */ - @SuppressWarnings({"unchecked", "rawtypes"}) - private boolean extractAsStoreAttachment(ArchiveUnit node, boolean writeFlag) throws MailExtractLibException, InterruptedException { + @SuppressWarnings({ "unchecked", "rawtypes" }) + private boolean extractAsStoreAttachment(ArchiveUnit node, boolean writeFlag) + throws MailExtractLibException, InterruptedException { StoreExtractor fatherExtractor = fatherElement.getStoreExtractor(); Boolean isContainerScheme = false; StoreExtractor extractor = null; - doProgressLog(fatherExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, - "mailextractlib: begin " + attachmentStoreScheme + " store content extraction from an attachment in " + fatherElement.getLogDescription(), null); + doProgressLog( + fatherExtractor.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: begin " + + attachmentStoreScheme + + " store content extraction from an attachment in " + + fatherElement.getLogDescription(), + null + ); Class storeExtractorClass = StoreExtractor.schemeStoreExtractorClassMap.get(attachmentStoreScheme); if (storeExtractorClass == null) { - fatherElement.logMessageWarning("mailextractlib: unknown embedded store type=" + attachmentStoreScheme - + " , extracting unit in path " + node.getFullName(), null); + fatherElement.logMessageWarning( + "mailextractlib: unknown embedded store type=" + + attachmentStoreScheme + + " , extracting unit in path " + + node.getFullName(), + null + ); } else { isContainerScheme = StoreExtractor.schemeContainerMap.get(attachmentStoreScheme); if (isContainerScheme) { - node = new ArchiveUnit(fatherExtractor, node, "Container", - (name == null ? "Infile" : name)); + node = new ArchiveUnit(fatherExtractor, node, "Container", (name == null ? "Infile" : name)); node.addMetadata("DescriptionLevel", "Item", true); - node.addMetadata("Title", - "Conteneur " + attachmentStoreScheme + (name == null ? "" : " " + name), true); - node.addMetadata("Description", - "Extraction d'un conteneur " + attachmentStoreScheme + (name == null ? "" : " " + name), - true); + node.addMetadata( + "Title", + "Conteneur " + attachmentStoreScheme + (name == null ? "" : " " + name), + true + ); + node.addMetadata( + "Description", + "Extraction d'un conteneur " + attachmentStoreScheme + (name == null ? "" : " " + name), + true + ); } try { extractor = (StoreExtractor) storeExtractorClass - .getConstructor(StoreAttachment.class, ArchiveUnit.class, StoreExtractorOptions.class, - StoreExtractor.class, StoreElement.class, MailExtractProgressLogger.class) - .newInstance(this, node, fatherExtractor.options, fatherExtractor, fatherElement, fatherElement.getProgressLogger()); + .getConstructor( + StoreAttachment.class, + ArchiveUnit.class, + StoreExtractorOptions.class, + StoreExtractor.class, + StoreElement.class, + MailExtractProgressLogger.class + ) + .newInstance( + this, + node, + fatherExtractor.options, + fatherExtractor, + fatherElement, + fatherElement.getProgressLogger() + ); } catch (InvocationTargetException e) { Throwable te = e.getCause(); - fatherElement.logMessageWarning("mailextractlib: dysfonctional embedded store type=" + attachmentStoreScheme - + " , extracting unit in path " + node.getFullName(), te); - } - catch (Exception e){ - fatherElement.logMessageWarning("mailextractlib: dysfonctional embedded store type=" + attachmentStoreScheme - + " , extracting unit in path " + node.getFullName(), e); + fatherElement.logMessageWarning( + "mailextractlib: dysfonctional embedded store type=" + + attachmentStoreScheme + + " , extracting unit in path " + + node.getFullName(), + te + ); + } catch (Exception e) { + fatherElement.logMessageWarning( + "mailextractlib: dysfonctional embedded store type=" + + attachmentStoreScheme + + " , extracting unit in path " + + node.getFullName(), + e + ); } } if (extractor != null) { @@ -408,20 +461,39 @@ private boolean extractAsStoreAttachment(ArchiveUnit node, boolean writeFlag) th fatherExtractor.accumulateSubElements(extractor); extractor.endStoreExtractor(); if (extractor.getRootFolder().getDateRange().isDefined() && isContainerScheme) { - node.addMetadata("StartDate", - DateRange.getISODateString(extractor.getRootFolder().getDateRange().getStart()), true); - node.addMetadata("EndDate", - DateRange.getISODateString(extractor.getRootFolder().getDateRange().getEnd()), true); + node.addMetadata( + "StartDate", + DateRange.getISODateString(extractor.getRootFolder().getDateRange().getStart()), + true + ); + node.addMetadata( + "EndDate", + DateRange.getISODateString(extractor.getRootFolder().getDateRange().getEnd()), + true + ); } - if (writeFlag) - node.write(); - doProgressLog(fatherExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, - "mailextractlib: end " + attachmentStoreScheme + " store content extraction from an attachment in " + fatherElement.getLogDescription(), null); + if (writeFlag) node.write(); + doProgressLog( + fatherExtractor.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: end " + + attachmentStoreScheme + + " store content extraction from an attachment in " + + fatherElement.getLogDescription(), + null + ); } catch (MailExtractLibException ee) { - doProgressLog(fatherExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, - "mailextractlib: can't extract " + attachmentStoreScheme + " store content from an attachment in " + fatherElement.getLogDescription(), ee); + doProgressLog( + fatherExtractor.getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: can't extract " + + attachmentStoreScheme + + " store content from an attachment in " + + fatherElement.getLogDescription(), + ee + ); } } - return(extractor != null); + return (extractor != null); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java index bd2c66b1..bc0ae99a 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreContact.java @@ -102,12 +102,14 @@ protected StoreContact(StoreFolder storeFolder) { @Override public String getLogDescription() { String result = "contact " + listLineId; - if (fullName != null) - result += " [" + fullName + "]"; - else if ((givenName != null) || (lastName != null)) - result += " [" + (givenName != null ? givenName : "NoGivenName") + " " + (lastName != null ? lastName : "NoLastName") + "]"; - else - result += " [no name]"; + if (fullName != null) result += " [" + fullName + "]"; + else if ((givenName != null) || (lastName != null)) result += + " [" + + (givenName != null ? givenName : "NoGivenName") + + " " + + (lastName != null ? lastName : "NoLastName") + + "]"; + else result += " [no name]"; return result; } @@ -122,7 +124,7 @@ else if ((givenName != null) || (lastName != null)) * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) * @throws InterruptedException the interrupted exception */ - abstract public void analyzeAllContactInformations() throws MailExtractLibException, InterruptedException; + public abstract void analyzeAllContactInformations() throws MailExtractLibException, InterruptedException; /** * Analyze contact to collect contact picture if any. @@ -134,7 +136,7 @@ else if ((givenName != null) || (lastName != null)) * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) * @throws InterruptedException the interrupted exception */ - abstract public void analyzeContactPicture() throws MailExtractLibException, InterruptedException; + public abstract void analyzeContactPicture() throws MailExtractLibException, InterruptedException; /** * Analyze contact to collect contact information and optionally picture. @@ -146,8 +148,7 @@ public void analyzeContact() throws MailExtractLibException, InterruptedExceptio analyzeAllContactInformations(); try { analyzeContactPicture(); - } catch (MailExtractLibException ignored) { - } + } catch (MailExtractLibException ignored) {} } /** @@ -155,7 +156,7 @@ public void analyzeContact() throws MailExtractLibException, InterruptedExceptio * * @return the element name */ - static public String getElementName() { + public static String getElementName() { return "contacts"; } @@ -164,13 +165,15 @@ static public String getElementName() { * * @param ps the dedicated print stream */ - static public void printGlobalListCSVHeader(PrintStream ps) { + public static void printGlobalListCSVHeader(PrintStream ps) { synchronized (ps) { - ps.println("ID;Full Name;Given Name;Last Name;Misc Notes;Company;Department;Title;Default Address;" + - "SMTP Mail Address;Default Telephone Number;Mobile Telephone Number;Business HomePage;Business Location;" + - "Business Telephone Number;Business Address;RefID;" + - "Other Mail Addresses;Other Telephone Numbers;Assistant Name;Assistant Telephone Number;Personal HomePage;" + - "Home Location;Home Telephone Number;Home Address;Nickname"); + ps.println( + "ID;Full Name;Given Name;Last Name;Misc Notes;Company;Department;Title;Default Address;" + + "SMTP Mail Address;Default Telephone Number;Mobile Telephone Number;Business HomePage;Business Location;" + + "Business Telephone Number;Business Address;RefID;" + + "Other Mail Addresses;Other Telephone Numbers;Assistant Name;Assistant Telephone Number;Personal HomePage;" + + "Home Location;Home Telephone Number;Home Address;Nickname" + ); } } @@ -185,11 +188,10 @@ static public void printGlobalListCSVHeader(PrintStream ps) { */ public void extractContact(boolean writeFlag) throws InterruptedException, MailExtractLibException { if (writeFlag) { - if (storeFolder.getStoreExtractor().getOptions().extractElementsList) - writeToContactsList(); - if ((pictureData != null) - && storeFolder.getStoreExtractor().getOptions().extractElementsContent) - extractPicture(); + if (storeFolder.getStoreExtractor().getOptions().extractElementsList) writeToContactsList(); + if ( + (pictureData != null) && storeFolder.getStoreExtractor().getOptions().extractElementsContent + ) extractPicture(); } } @@ -228,12 +230,23 @@ private void writeToContactsList() { } private void extractPicture() throws InterruptedException, MailExtractLibException { - ArchiveUnit attachmentNode = new ArchiveUnit(storeFolder.storeExtractor, storeFolder.storeExtractor.destRootPath + - File.separator + storeFolder.storeExtractor.destName + File.separator + "contacts", "ContactPicture#" + listLineId); + ArchiveUnit attachmentNode = new ArchiveUnit( + storeFolder.storeExtractor, + storeFolder.storeExtractor.destRootPath + + File.separator + + storeFolder.storeExtractor.destName + + File.separator + + "contacts", + "ContactPicture#" + listLineId + ); attachmentNode.addMetadata("DescriptionLevel", "Item", true); attachmentNode.addMetadata("Title", "Contact Picture #" + listLineId, true); attachmentNode.addMetadata("Description", "Contact picture extracted for " + fullName, true); - attachmentNode.addPersonMetadata("Recipient", fullName + (smtpAddress.isEmpty() ? "" : "<" + smtpAddress + ">"), false); + attachmentNode.addPersonMetadata( + "Recipient", + fullName + (smtpAddress.isEmpty() ? "" : "<" + smtpAddress + ">"), + false + ); attachmentNode.addObject(pictureData, pictureFileName, "BinaryMaster", 1); attachmentNode.write(); } @@ -249,7 +262,8 @@ public void processElement(boolean writeFlag) throws InterruptedException, MailE @Override public void listElement(boolean statsFlag) throws InterruptedException, MailExtractLibException { - if (storeFolder.getStoreExtractor().getOptions().extractContacts) - listLineId = storeFolder.getStoreExtractor().incElementCounter(this.getClass()); + if (storeFolder.getStoreExtractor().getOptions().extractContacts) listLineId = storeFolder + .getStoreExtractor() + .incElementCounter(this.getClass()); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java index fc734514..2c047625 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreElement.java @@ -64,7 +64,7 @@ public abstract class StoreElement { */ public StoreElement(StoreFolder storeFolder) { this.storeFolder = storeFolder; - this.listLineId=-1; + this.listLineId = -1; } /** @@ -100,21 +100,23 @@ public StoreExtractor getStoreExtractor() { * @throws InterruptedException the interrupted exception */ public void logMessageWarning(String msg, Throwable t) throws InterruptedException { - msg+= " for "+ getLogDescription(); - StoreElement fatherElement=getStoreExtractor().getFatherElement(); - while (fatherElement!=null) { - msg+=" in "+ fatherElement.getLogDescription(); - fatherElement=fatherElement.getStoreExtractor().getFatherElement(); + msg += " for " + getLogDescription(); + StoreElement fatherElement = getStoreExtractor().getFatherElement(); + while (fatherElement != null) { + msg += " in " + fatherElement.getLogDescription(); + fatherElement = fatherElement.getStoreExtractor().getFatherElement(); } Exception ex = null; - if (t instanceof Exception) - ex = (Exception) t; + if (t instanceof Exception) ex = (Exception) t; - if (storeFolder.getStoreExtractor().options.warningMsgProblem) - doProgressLog(getProgressLogger(), MailExtractProgressLogger.WARNING, msg, ex); - else - doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, ex); + if (storeFolder.getStoreExtractor().options.warningMsgProblem) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.WARNING, + msg, + ex + ); + else doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, ex); } /** @@ -122,7 +124,7 @@ public void logMessageWarning(String msg, Throwable t) throws InterruptedExcepti * * @return the log description */ - abstract public String getLogDescription(); + public abstract String getLogDescription(); /** * Whole process of extraction on one element (analysis, extraction, count...). @@ -131,7 +133,7 @@ public void logMessageWarning(String msg, Throwable t) throws InterruptedExcepti * @throws InterruptedException the interrupted exception * @throws MailExtractLibException the mail extract lib exception */ - abstract public void processElement(boolean writeFlag) throws InterruptedException, MailExtractLibException; + public abstract void processElement(boolean writeFlag) throws InterruptedException, MailExtractLibException; /** * Limited process of listing on one element (analysis, count...). @@ -140,7 +142,7 @@ public void logMessageWarning(String msg, Throwable t) throws InterruptedExcepti * @throws InterruptedException the interrupted exception * @throws MailExtractLibException the mail extract lib exception */ - abstract public void listElement(boolean statsFlag) throws InterruptedException, MailExtractLibException; + public abstract void listElement(boolean statsFlag) throws InterruptedException, MailExtractLibException; /** * Filter hyphen for csv string. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java index d46d4fce..3c3900c9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractor.java @@ -45,9 +45,8 @@ import fr.gouv.vitam.tools.mailextractlib.utils.DateRange; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; -import org.apache.poi.util.IOUtils; - import jakarta.mail.URLName; +import org.apache.poi.util.IOUtils; import java.io.File; import java.io.IOException; @@ -67,7 +66,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; @@ -184,11 +182,11 @@ public abstract class StoreExtractor { * The formatter used for zoned date conversion to String */ public static final DateTimeFormatter ISO_8601 = new DateTimeFormatterBuilder() - .append(ISO_LOCAL_DATE_TIME) - .optionalStart() - .appendOffsetId() - .optionalStart() - .toFormatter(); + .append(ISO_LOCAL_DATE_TIME) + .optionalStart() + .appendOffsetId() + .optionalStart() + .toFormatter(); /** * The map of mimetypes/scheme known relations. @@ -227,14 +225,14 @@ public abstract class StoreExtractor { * - PstStoreExtractor * - PstEmbeddedStoreExtractor * - * 3. Sets the maximum allowed size for byte arrays in Apache POI to prevent extraction - * failures when handling large attachments in TNEF files. This change overrides + * 3. Sets the maximum allowed size for byte arrays in Apache POI to prevent extraction + * failures when handling large attachments in TNEF files. This change overrides * the default 1 MB limit with a maximum value of 2 GB. * * 4. Configures Jakarta Mail properties to handle malformed MIME messages: * - Enables fallback for unknown content-transfer-encoding values, which allows * the parsing of messages with invalid encoding values (e.g., "iso-8859-1"). - * - Disables strict decoding of MIME-encoded headers, allowing the library + * - Disables strict decoding of MIME-encoded headers, allowing the library * to tolerate malformed headers and return raw, undecoded text instead of throwing exceptions. * - Enables lenient Base64 decoding to tolerate malformed or corrupted Base64 encoded data, * avoiding exceptions during data extraction. @@ -242,7 +240,6 @@ public abstract class StoreExtractor { * 4. Sets the default time zone for the application to UTC. */ public static void initDefaultExtractors(boolean allowsExternalToolsForTextExtraction) { - if (!allowsExternalToolsForTextExtraction) { preventExternalToolsForTextExtractionInTika(); } @@ -414,8 +411,12 @@ private static void preventExternalToolsForTextExtractionInTika() { /** * The accumulated elements classes */ - static Class[] accumulatedElements = {StoreFolder.class, StoreMessage.class, - StoreAppointment.class, StoreContact.class}; + static Class[] accumulatedElements = { + StoreFolder.class, + StoreMessage.class, + StoreAppointment.class, + StoreContact.class, + }; /** * The extracted elements counters map. @@ -442,8 +443,7 @@ private static void preventExternalToolsForTextExtractionInTika() { * Useful only for testing purposes. */ private static final double THREAD_MULTIPLIER = Double.parseDouble(System.getProperty("thread.factor", "1.5")); - private int maxParallelThreads = (int) Math.round( - Runtime.getRuntime().availableProcessors() * THREAD_MULTIPLIER); + private int maxParallelThreads = (int) Math.round(Runtime.getRuntime().availableProcessors() * THREAD_MULTIPLIER); /** * Add mimetypes, scheme, isContainer, store extractor known relation. @@ -460,12 +460,16 @@ private static void preventExternalToolsForTextExtractionInTika() { * @param extractor the extractor */ @SuppressWarnings("rawtypes") - public static void addExtractionRelation(String mimeType, String droidFormat, String scheme, boolean isContainer, Class extractor) { + public static void addExtractionRelation( + String mimeType, + String droidFormat, + String scheme, + boolean isContainer, + Class extractor + ) { // if there is a file mimetype for this scheme - if (mimeType != null) - mimeTypeSchemeMap.put(mimeType, scheme); - if (droidFormat != null) - droidFormatSchemeMap.put(droidFormat, scheme); + if (mimeType != null) mimeTypeSchemeMap.put(mimeType, scheme); + if (droidFormat != null) droidFormatSchemeMap.put(droidFormat, scheme); schemeStoreExtractorClassMap.put(scheme, extractor); schemeContainerMap.put(scheme, isContainer); } @@ -497,16 +501,12 @@ public static String composeStoreURL(String scheme, String authority, String use result = scheme + "://"; if (user != null && !user.isEmpty()) { result += URLEncoder.encode(user, "UTF-8"); - if (password != null && !password.isEmpty()) - result += ":" + URLEncoder.encode(password, "UTF-8"); + if (password != null && !password.isEmpty()) result += ":" + URLEncoder.encode(password, "UTF-8"); result += "@"; } - if (authority != null && !authority.isEmpty()) - result += authority; - else - result += "localhost"; - if (path != null && !path.isEmpty()) - result += "/" + URLEncoder.encode(path, "UTF-8"); + if (authority != null && !authority.isEmpty()) result += authority; + else result += "localhost"; + if (path != null && !path.isEmpty()) result += "/" + URLEncoder.encode(path, "UTF-8"); } catch (UnsupportedEncodingException e) { // impossible case with UTF-8 } @@ -522,24 +522,33 @@ public static String composeStoreURL(String scheme, String authority, String use * @return the initialized global list ps */ @SuppressWarnings("unchecked") - synchronized public PrintStream getGlobalListPS(Class listClass) { + public synchronized PrintStream getGlobalListPS(Class listClass) { String globalListName = null; PrintStream result = null; try { globalListName = (String) listClass.getMethod("getElementName").invoke(null); result = globalListsPSMap.get(globalListName); if (result == null) { - String dirname = this.destRootPath - + File.separator + this.destName + File.separator; + String dirname = this.destRootPath + File.separator + this.destName + File.separator; Files.createDirectories(Paths.get(dirname)); result = new PrintStream(dirname + listClass.getMethod("getElementName").invoke(null) + ".csv"); globalListsPSMap.put(globalListName, result); listClass.getMethod("printGlobalListCSVHeader", PrintStream.class).invoke(null, result); } } catch (IOException | NoSuchMethodException | IllegalAccessException e) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create global list for [" + globalListName + "] csv file", e); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create global list for [" + globalListName + "] csv file", + e + ); } catch (InvocationTargetException te) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create global list for [" + globalListName + "] csv file", te.getTargetException()); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create global list for [" + globalListName + "] csv file", + te.getTargetException() + ); } return result; } @@ -555,7 +564,7 @@ synchronized public PrintStream getGlobalListPS(Class listClass) { * @return the initialized global list counter */ @SuppressWarnings("unchecked") - synchronized public int getElementCounter(Class listClass, boolean subFlag) { + public synchronized int getElementCounter(Class listClass, boolean subFlag) { String elementName = null; Integer result = 0; try { @@ -566,14 +575,31 @@ synchronized public int getElementCounter(Class listClass, boolean subFlag) { result = 0; } } catch (NoSuchMethodException | IllegalAccessException e) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create counter for " + (subFlag ? "sub " : "") + "[" + elementName + "] csv file", e); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create counter for " + + (subFlag ? "sub " : "") + + "[" + + elementName + + "] csv file", + e + ); } catch (InvocationTargetException te) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create counter for " + (subFlag ? "sub " : "") + "[" + elementName + "] csv file", te.getTargetException()); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create counter for " + + (subFlag ? "sub " : "") + + "[" + + elementName + + "] csv file", + te.getTargetException() + ); } return result; } - /** * Adds a value to the counter for a specific type of extracted element (e.g., message, folder, appointment, contact...) and returns the updated counter. *

If the counter does not exist, it is initialized with the provided value and then returned. @@ -586,26 +612,41 @@ synchronized public int getElementCounter(Class listClass, boolean subFlag) { * @return the updated counter value */ @SuppressWarnings("unchecked") - synchronized public int addElementCounter(int value, Class listClass, boolean subFlag) { + public synchronized int addElementCounter(int value, Class listClass, boolean subFlag) { String elementName = null; Integer result = 0; try { elementName = (String) listClass.getMethod("getElementName").invoke(null); result = (subFlag ? subElementsCounterMap : elementsCounterMap).get(elementName); - if (result == null) - result = value; - else - result += value; + if (result == null) result = value; + else result += value; (subFlag ? subElementsCounterMap : elementsCounterMap).put(elementName, result); } catch (NoSuchMethodException | IllegalAccessException e) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create counter for " + (subFlag ? "sub " : "") + "[" + elementName + "] csv file", e); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create counter for " + + (subFlag ? "sub " : "") + + "[" + + elementName + + "] csv file", + e + ); } catch (InvocationTargetException te) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: can't create counter for " + (subFlag ? "sub " : "") + "[" + elementName + "] csv file", te.getTargetException()); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextractlib: can't create counter for " + + (subFlag ? "sub " : "") + + "[" + + elementName + + "] csv file", + te.getTargetException() + ); } return result; } - /** * Increment the counter for a certain type of extracted element (message, folder, appointment, contact...), and return the counter if it exists. *

If not init the counter to 1, and return the counter. @@ -624,12 +665,10 @@ public int incElementCounter(Class listClass) { * * @param subExtractor the sub extractor */ - synchronized public void accumulateSubElements(StoreExtractor subExtractor) { + public synchronized void accumulateSubElements(StoreExtractor subExtractor) { for (Class c : accumulatedElements) { - int value = subExtractor.getElementCounter(c, false) + - subExtractor.getElementCounter(c, true); - if (value > 0) - addElementCounter(value, c, true); + int value = subExtractor.getElementCounter(c, false) + subExtractor.getElementCounter(c, true); + if (value > 0) addElementCounter(value, c, true); } } @@ -654,9 +693,15 @@ protected void closeGlobalListsPSMap() { * @param logger logger used * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) */ - protected StoreExtractor(String urlString, String rootStoreFolderName, String destPathString, StoreExtractorOptions options, - StoreExtractor fatherStoreExtractor, StoreElement fatherElement, MailExtractProgressLogger logger) throws MailExtractLibException { - + protected StoreExtractor( + String urlString, + String rootStoreFolderName, + String destPathString, + StoreExtractorOptions options, + StoreExtractor fatherStoreExtractor, + StoreElement fatherElement, + MailExtractProgressLogger logger + ) throws MailExtractLibException { URLName url; url = new URLName(urlString); @@ -668,12 +713,9 @@ protected StoreExtractor(String urlString, String rootStoreFolderName, String de String tempPassword = null; String tempPath = null; try { - if (url.getUsername() != null) - tempUser = URLDecoder.decode(url.getUsername(), "UTF-8"); - if (url.getPassword() != null) - tempPassword = URLDecoder.decode(url.getPassword(), "UTF-8"); - if (url.getFile() != null) - tempPath = URLDecoder.decode(url.getFile(), "UTF-8"); + if (url.getUsername() != null) tempUser = URLDecoder.decode(url.getUsername(), "UTF-8"); + if (url.getPassword() != null) tempPassword = URLDecoder.decode(url.getPassword(), "UTF-8"); + if (url.getFile() != null) tempPath = URLDecoder.decode(url.getFile(), "UTF-8"); } catch (UnsupportedEncodingException ignored) { // not possible } @@ -684,19 +726,15 @@ protected StoreExtractor(String urlString, String rootStoreFolderName, String de this.rootStoreFolderName = rootStoreFolderName; this.destRootPath = Paths.get(destPathString).toAbsolutePath().normalize().getParent().toString(); this.destName = Paths.get(destPathString).toAbsolutePath().normalize().getFileName().toString(); - if (options == null) - this.options = new StoreExtractorOptions(); - else - this.options = options; + if (options == null) this.options = new StoreExtractorOptions(); + else this.options = options; this.totalRawSize = new AtomicLong(0); this.fatherStoreExtractor = fatherStoreExtractor; this.fatherElement = fatherElement; - if (fatherStoreExtractor == null) - this.rootStoreExtractor = this; - else - this.rootStoreExtractor = fatherStoreExtractor.rootStoreExtractor; + if (fatherStoreExtractor == null) this.rootStoreExtractor = this; + else this.rootStoreExtractor = fatherStoreExtractor.rootStoreExtractor; this.logger = logger; this.description = ":p:" + scheme + ":u:" + user; @@ -707,8 +745,20 @@ protected StoreExtractor(String urlString, String rootStoreFolderName, String de uniqID = new AtomicInteger(0); - doProgressLogIfDebug(logger, "StoreExtractor [" + this + "] created with url=" + urlString + - " rootFolder=" + rootStoreFolderName + " destPath=" + destPathString + " rootExtractor=" + fatherStoreExtractor, null); + doProgressLogIfDebug( + logger, + "StoreExtractor [" + + this + + "] created with url=" + + urlString + + " rootFolder=" + + rootStoreFolderName + + " destPath=" + + destPathString + + " rootExtractor=" + + fatherStoreExtractor, + null + ); } /** @@ -717,19 +767,35 @@ protected StoreExtractor(String urlString, String rootStoreFolderName, String de * @throws InterruptedException the interrupted exception */ public void writeTargetLog() throws InterruptedException { - // if root extractor log extraction context if (fatherStoreExtractor == null) { - doProgressLog(logger, MailExtractProgressLogger.GLOBAL, - "mailextract :target store with scheme=" + scheme + (host == null || host.isEmpty() ? "" : " server=" + host) - + (port == -1 ? "" : ":" + Integer.toString(port)) - + (user == null || user.isEmpty() ? "" : " user=" + user) - + (password == null || password.isEmpty() ? "" : " password=" + password) - + (path == null || path.isEmpty() ? "" : " path=" + path) - + (rootStoreFolderName == null || rootStoreFolderName.isEmpty() ? "" : " store folder=" + rootStoreFolderName), null); - doProgressLog(logger, MailExtractProgressLogger.GLOBAL, "to " + destRootPath + " in " + destName + " directory", null); - if ((logger != null) && logger.getDebugFlag()) - doProgressLog(logger, MailExtractProgressLogger.GLOBAL, "DEBUG MODE", null); + doProgressLog( + logger, + MailExtractProgressLogger.GLOBAL, + "mailextract :target store with scheme=" + + scheme + + (host == null || host.isEmpty() ? "" : " server=" + host) + + (port == -1 ? "" : ":" + Integer.toString(port)) + + (user == null || user.isEmpty() ? "" : " user=" + user) + + (password == null || password.isEmpty() ? "" : " password=" + password) + + (path == null || path.isEmpty() ? "" : " path=" + path) + + (rootStoreFolderName == null || rootStoreFolderName.isEmpty() + ? "" + : " store folder=" + rootStoreFolderName), + null + ); + doProgressLog( + logger, + MailExtractProgressLogger.GLOBAL, + "to " + destRootPath + " in " + destName + " directory", + null + ); + if ((logger != null) && logger.getDebugFlag()) doProgressLog( + logger, + MailExtractProgressLogger.GLOBAL, + "DEBUG MODE", + null + ); boolean first = true; String optionsLog = ""; @@ -738,19 +804,16 @@ public void writeTargetLog() throws InterruptedException { first = false; } if (options.dropEmptyFolders) { - if (!first) - optionsLog += ", "; + if (!first) optionsLog += ", "; optionsLog += "droping all empty folders"; first = false; } if (options.warningMsgProblem) { - if (!first) - optionsLog += ", "; + if (!first) optionsLog += ", "; optionsLog += "generate warning when there's a problem on a message (otherwise log at FINEST level)"; first = false; } - if (!first) - optionsLog += ", "; + if (!first) optionsLog += ", "; optionsLog += "with names length=" + Integer.toString(options.namesLength); optionsLog += ", "; optionsLog += "with log level " + getProgressLogger().getLevelName(); @@ -793,12 +856,10 @@ public boolean hasDestName() { * @return a unique ID */ - synchronized public int getNewUniqID() { + public synchronized int getNewUniqID() { int id; - if (fatherStoreExtractor == null) - id = uniqID.addAndGet(1); - else - id = rootStoreExtractor.getNewUniqID(); + if (fatherStoreExtractor == null) id = uniqID.addAndGet(1); + else id = rootStoreExtractor.getNewUniqID(); return id; } @@ -890,11 +951,23 @@ public StoreElement getFatherElement() { * @return the store extractor, constructed as a non abstract subclass * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) */ - public static StoreExtractor createStoreExtractor(String urlString, String rootStoreFolderName, String destPathString, - StoreExtractorOptions options, MailExtractProgressLogger logger) throws MailExtractLibException { + public static StoreExtractor createStoreExtractor( + String urlString, + String rootStoreFolderName, + String destPathString, + StoreExtractorOptions options, + MailExtractProgressLogger logger + ) throws MailExtractLibException { StoreExtractor storeExtractor; - storeExtractor = createInternalStoreExtractor(urlString, rootStoreFolderName, destPathString, options, null, logger); + storeExtractor = createInternalStoreExtractor( + urlString, + rootStoreFolderName, + destPathString, + options, + null, + logger + ); return storeExtractor; } @@ -902,20 +975,26 @@ public static StoreExtractor createStoreExtractor(String urlString, String rootS /** * Create an internal depth store extractor as a factory creator. */ - @SuppressWarnings({"unchecked", "rawtypes"}) - private static StoreExtractor createInternalStoreExtractor(String urlString, String rootStoreFolderName, - String destPathString, StoreExtractorOptions options, StoreExtractor - rootStoreExtractor, MailExtractProgressLogger logger + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static StoreExtractor createInternalStoreExtractor( + String urlString, + String rootStoreFolderName, + String destPathString, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + MailExtractProgressLogger logger ) throws MailExtractLibException { - StoreExtractor store; URLName url; url = new URLName(urlString); // get read of leading file separator in folder - if ((rootStoreFolderName != null) && (!rootStoreFolderName.isEmpty()) && (rootStoreFolderName.substring(0, 1).equals(File.separator))) - rootStoreFolderName = rootStoreFolderName.substring(1); + if ( + (rootStoreFolderName != null) && + (!rootStoreFolderName.isEmpty()) && + (rootStoreFolderName.substring(0, 1).equals(File.separator)) + ) rootStoreFolderName = rootStoreFolderName.substring(1); // find the store extractor constructor for scheme in URL Class storeExtractorClass = StoreExtractor.schemeStoreExtractorClassMap.get(url.getProtocol()); @@ -923,11 +1002,23 @@ private static StoreExtractor createInternalStoreExtractor(String urlString, Str throw new MailExtractLibException("mailextractlib: unknown store type=" + url.getProtocol(), null); } else { try { - store = (StoreExtractor) storeExtractorClass.getConstructor(String.class, String.class, String.class, - StoreExtractorOptions.class, StoreExtractor.class, MailExtractProgressLogger.class) - .newInstance(urlString, rootStoreFolderName, destPathString, options, rootStoreExtractor, logger); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException - | SecurityException e) { + store = (StoreExtractor) storeExtractorClass + .getConstructor( + String.class, + String.class, + String.class, + StoreExtractorOptions.class, + StoreExtractor.class, + MailExtractProgressLogger.class + ) + .newInstance(urlString, rootStoreFolderName, destPathString, options, rootStoreExtractor, logger); + } catch ( + InstantiationException + | IllegalAccessException + | IllegalArgumentException + | NoSuchMethodException + | SecurityException e + ) { throw new MailExtractLibException("mailextractlib: dysfonctional store type=" + url.getProtocol(), e); } catch (InvocationTargetException e) { Throwable te = e.getCause(); @@ -938,9 +1029,8 @@ private static StoreExtractor createInternalStoreExtractor(String urlString, Str } private static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -962,15 +1052,12 @@ public String getSummary() { } Integer count = elementsCounterMap.get(elementName); if ((count != null) && (count > 0)) { - if (!elementSummary.isEmpty()) - elementSummary += ","; + if (!elementSummary.isEmpty()) elementSummary += ","; elementSummary += " " + count + " " + elementName; } } - if (elementSummary.isEmpty()) - summary += " empty extraction"; - else - summary += " writing" + elementSummary; + if (elementSummary.isEmpty()) summary += " empty extraction"; + else summary += " writing" + elementSummary; String subElementSummary = ""; for (Class elementClass : accumulatedElements) { String elementName = null; @@ -981,15 +1068,12 @@ public String getSummary() { } Integer count = subElementsCounterMap.get(elementName); if ((count != null) && (count > 0)) { - if (!subElementSummary.isEmpty()) - subElementSummary += ","; + if (!subElementSummary.isEmpty()) subElementSummary += ","; subElementSummary += " " + count + " " + elementName; } } - if (subElementSummary.isEmpty()) - summary += " without embedded elements"; - else - summary += " with" + subElementSummary + " embedded"; + if (subElementSummary.isEmpty()) summary += " without embedded elements"; + else summary += " with" + subElementSummary + " embedded"; summary += " for a total size of " + readableFileSize(getTotalRawSize()); return summary; } @@ -1020,19 +1104,23 @@ public void extractAllFolders() throws MailExtractLibException, InterruptedExcep rootNode.addMetadata("DescriptionLevel", "RecordGrp", true); // title generation from context - if ((user != null) && (!user.isEmpty())) - title = "Ensemble des messages électroniques et informations associées (contacts, rendez-vous...) envoyés et reçus par le compte " + user; - else if ((path != null) && (!path.isEmpty())) - title = "Ensemble des messages électroniques et informations associées (contacts, rendez-vous...) du container " + path; - else - title = "Ensemble de messages électroniques et informations associées (contacts, rendez-vous...)"; - if ((host != null) && (!host.isEmpty()) && (!host.equals("localhost"))) - title += " sur le serveur " + host + (port == -1 ? "" : ":" + Integer.toString(port)); + if ((user != null) && (!user.isEmpty())) title = + "Ensemble des messages électroniques et informations associées (contacts, rendez-vous...) envoyés et reçus par le compte " + + user; + else if ((path != null) && (!path.isEmpty())) title = + "Ensemble des messages électroniques et informations associées (contacts, rendez-vous...) du container " + + path; + else title = "Ensemble de messages électroniques et informations associées (contacts, rendez-vous...)"; + if ((host != null) && (!host.isEmpty()) && (!host.equals("localhost"))) title += + " sur le serveur " + host + (port == -1 ? "" : ":" + Integer.toString(port)); title += " à la date du " + start; rootNode.addMetadata("Title", title, true); if (rootStoreFolder.getDateRange().isDefined()) { - rootNode.addMetadata("StartDate", DateRange.getISODateString(rootStoreFolder.getDateRange().getStart()), - true); + rootNode.addMetadata( + "StartDate", + DateRange.getISODateString(rootStoreFolder.getDateRange().getStart()), + true + ); rootNode.addMetadata("EndDate", DateRange.getISODateString(rootStoreFolder.getDateRange().getEnd()), true); } rootNode.write(); @@ -1063,7 +1151,7 @@ public void listAllFolders(boolean stats) throws MailExtractLibException, Interr start = Instant.now(); - int memProgressLogLevel=logger.getProgressLogLevel(); + int memProgressLogLevel = logger.getProgressLogLevel(); logger.setProgressLogLevel(GLOBAL); writeTargetLog(); doProgressLog(logger, MailExtractProgressLogger.GLOBAL, "mailextractlib: listing begin", null); @@ -1106,11 +1194,9 @@ public static boolean hasMagicNumber(byte[] content, byte[] magicNumber) { * @return true, if successful */ public static boolean hasMagicNumber(byte[] content, byte[] magicNumber, int offset) { - if (content.length < magicNumber.length + offset) - return false; + if (content.length < magicNumber.length + offset) return false; for (int i = 0; i < magicNumber.length; i++) { - if (content[i + offset] != magicNumber[i]) - return false; + if (content[i + offset] != magicNumber[i]) return false; } return true; } @@ -1168,5 +1254,4 @@ public void setMaxParallelThreads(int maxParallelThreads) { public StoreExtractor getRootStoreExtractor() { return rootStoreExtractor; } - -} \ No newline at end of file +} diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java index f502bad5..150b7e8d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreExtractorOptions.java @@ -126,10 +126,19 @@ public StoreExtractorOptions() { * @param extractFileTextMetadata the extract file text metadata flag * @param model the model version (1 or 2) */ - public StoreExtractorOptions(boolean keepOnlyDeepEmptyFolders, boolean dropEmptyFolders, boolean warningMsgProblem, - int namesLength, String defaultCharsetName, boolean extractElementsList, boolean extractMessageTextFile, - boolean extractMessageTextMetadata, - boolean extractFileTextFile, boolean extractFileTextMetadata, int model) { + public StoreExtractorOptions( + boolean keepOnlyDeepEmptyFolders, + boolean dropEmptyFolders, + boolean warningMsgProblem, + int namesLength, + String defaultCharsetName, + boolean extractElementsList, + boolean extractMessageTextFile, + boolean extractMessageTextMetadata, + boolean extractFileTextFile, + boolean extractFileTextMetadata, + int model + ) { this.keepOnlyDeepEmptyFolders = keepOnlyDeepEmptyFolders; this.dropEmptyFolders = dropEmptyFolders; this.warningMsgProblem = warningMsgProblem; @@ -166,14 +175,23 @@ public StoreExtractorOptions(boolean keepOnlyDeepEmptyFolders, boolean dropEmpty * @param extractFileTextMetadata the extract file text metadata flag * @param model the model version (1 or 2) */ - public StoreExtractorOptions(boolean keepOnlyDeepEmptyFolders, boolean dropEmptyFolders, boolean warningMsgProblem, - int namesLength, String defaultCharsetName, - boolean extractMessages, boolean extractContacts, boolean extractAppointments, - boolean extractElementsContent, - boolean extractElementsList, - boolean extractMessageTextFile, - boolean extractMessageTextMetadata, - boolean extractFileTextFile, boolean extractFileTextMetadata, int model) { + public StoreExtractorOptions( + boolean keepOnlyDeepEmptyFolders, + boolean dropEmptyFolders, + boolean warningMsgProblem, + int namesLength, + String defaultCharsetName, + boolean extractMessages, + boolean extractContacts, + boolean extractAppointments, + boolean extractElementsContent, + boolean extractElementsList, + boolean extractMessageTextFile, + boolean extractMessageTextMetadata, + boolean extractFileTextFile, + boolean extractFileTextMetadata, + int model + ) { this.keepOnlyDeepEmptyFolders = keepOnlyDeepEmptyFolders; this.dropEmptyFolders = dropEmptyFolders; this.warningMsgProblem = warningMsgProblem; @@ -190,5 +208,4 @@ public StoreExtractorOptions(boolean keepOnlyDeepEmptyFolders, boolean dropEmpty this.extractFileTextMetadata = extractFileTextMetadata; this.model = model; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java index 0d362e28..3ceefe79 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreFolder.java @@ -114,7 +114,7 @@ protected StoreFolder(StoreExtractor storeExtractor) { * * @return the element name */ - static public String getElementName() { + public static String getElementName() { return "folders"; } @@ -129,7 +129,6 @@ static public String getElementName() { */ protected void finalizeStoreFolder(StoreFolder father) { folderArchiveUnit = new ArchiveUnit(storeExtractor, father.folderArchiveUnit, "Folder", getName()); - } /** @@ -148,10 +147,13 @@ public MailExtractProgressLogger getProgressLogger() { // log at the folder level considering storeExtractor depth private void logFolder(String msg) throws InterruptedException { - if (storeExtractor.isRoot()) - doProgressLog(storeExtractor.getProgressLogger(), MailExtractProgressLogger.FOLDER, msg, null); - else - doProgressLog(storeExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, null); + if (storeExtractor.isRoot()) doProgressLog( + storeExtractor.getProgressLogger(), + MailExtractProgressLogger.FOLDER, + msg, + null + ); + else doProgressLog(storeExtractor.getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, null); } /** @@ -167,7 +169,7 @@ public StoreExtractor getStoreExtractor() { * Extends the date range with the extra date range. *

This method is thread-safe, enabling non-abstract Folders and Elements to work on dateRange in parallel. **/ - synchronized public void extendDateRange(DateRange extraDateRange) { + public synchronized void extendDateRange(DateRange extraDateRange) { dateRange.extendRange(extraDateRange); } @@ -175,7 +177,7 @@ synchronized public void extendDateRange(DateRange extraDateRange) { * Extends the date range with the extra date. *

This method is thread-safe, enabling non-abstract Folders and Elements to work on dateRange in parallel. */ - synchronized public void extendDateRange(Date extraDate) { + public synchronized void extendDateRange(Date extraDate) { dateRange.extendRange(extraDate); } @@ -185,7 +187,7 @@ synchronized public void extendDateRange(Date extraDate) { * * @return the date range */ - synchronized public DateRange getDateRange() { + public synchronized DateRange getDateRange() { return dateRange; } @@ -309,11 +311,11 @@ public void extractFolderAsRoot(boolean writeFlag) throws MailExtractLibExceptio if (folderElementsCount.get() + folderSubFoldersCount.get() != 0) { // accumulate in store extractor statistics out of recursion // if the scheme is not a container one but an embedded message folder counter is not used - if (StoreExtractor.schemeContainerMap.get(storeExtractor.scheme)) - storeExtractor.incElementCounter(this.getClass()); + if (StoreExtractor.schemeContainerMap.get(storeExtractor.scheme)) storeExtractor.incElementCounter( + this.getClass() + ); storeExtractor.addTotalRawSize(getFolderElementsRawSize()); - } else - logFolder("mailextractlib: empty extraction"); + } else logFolder("mailextractlib: empty extraction"); } /** @@ -343,8 +345,11 @@ public boolean extractFolder(int level, boolean writeFlag) throws MailExtractLib extractFolderElements(writeFlag); // extract all subfolders in the folder to the unit directory extractSubFolders(level, writeFlag); - if ((folderElementsCount.get() + folderSubFoldersCount.get() != 0) || ((!storeExtractor.options.dropEmptyFolders) - && !(level == 1 && storeExtractor.options.keepOnlyDeepEmptyFolders))) { + if ( + (folderElementsCount.get() + folderSubFoldersCount.get() != 0) || + ((!storeExtractor.options.dropEmptyFolders) && + !(level == 1 && storeExtractor.options.keepOnlyDeepEmptyFolders)) + ) { // get specific folder metadata to the unit // compute and add to the folder ArchiveUnit the expected folder // metadata @@ -354,13 +359,13 @@ public boolean extractFolder(int level, boolean writeFlag) throws MailExtractLib folderArchiveUnit.addMetadata("StartDate", DateRange.getISODateString(dateRange.getStart()), true); folderArchiveUnit.addMetadata("EndDate", DateRange.getISODateString(dateRange.getEnd()), true); } - if (writeFlag) - folderArchiveUnit.write(); + if (writeFlag) folderArchiveUnit.write(); result = true; storeExtractor.incElementCounter(this.getClass()); storeExtractor.addTotalRawSize(getFolderElementsRawSize()); - } else - logFolder("mailextractlib: empty folder " + FileSystems.getDefault().getSeparator() + getFullName() + " is droped"); + } else logFolder( + "mailextractlib: empty folder " + FileSystems.getDefault().getSeparator() + getFullName() + " is droped" + ); // accumulate in store extractor statistics out of recursion return result; @@ -370,8 +375,7 @@ public boolean extractFolder(int level, boolean writeFlag) throws MailExtractLib private void extractFolderElements(boolean writeFlag) throws MailExtractLibException, InterruptedException { folderElementsCount.set(0); folderElementsRawSize.set(0); - if (hasElements()) - doExtractFolderElements(writeFlag); + if (hasElements()) doExtractFolderElements(writeFlag); } /** @@ -385,13 +389,13 @@ private void extractFolderElements(boolean writeFlag) throws MailExtractLibExcep * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) * @throws InterruptedException the interrupted exception */ - protected abstract void doExtractFolderElements(boolean writeFlag) throws MailExtractLibException, InterruptedException; + protected abstract void doExtractFolderElements(boolean writeFlag) + throws MailExtractLibException, InterruptedException; // encapsulate the subclasses real processing method private void extractSubFolders(int level, boolean writeFlag) throws MailExtractLibException, InterruptedException { folderSubFoldersCount.set(0); - if (hasSubfolders()) - doExtractSubFolders(level, writeFlag); + if (hasSubfolders()) doExtractSubFolders(level, writeFlag); } /** @@ -406,7 +410,8 @@ private void extractSubFolders(int level, boolean writeFlag) throws MailExtractL * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) * @throws InterruptedException the interrupted exception */ - protected abstract void doExtractSubFolders(int level, boolean writeFlag) throws MailExtractLibException, InterruptedException; + protected abstract void doExtractSubFolders(int level, boolean writeFlag) + throws MailExtractLibException, InterruptedException; /** * List all folders with or without statistics. @@ -425,18 +430,26 @@ public void listFolder(boolean stats) throws MailExtractLibException, Interrupte String fullName, tmp; fullName = getFullName(); - if (fullName == null || fullName.isEmpty()) - fullName = ""; + if (fullName == null || fullName.isEmpty()) fullName = ""; // log process on folder if (stats) { // inspect all elements in the folder for statistics listFolderElements(stats); // expose this folder statistics - tmp = String.format("%5d éléments %7.2f MBytes " + FileSystems.getDefault().getSeparator() + "%s", folderElementsCount.get(), - ((double) folderElementsRawSize.get()) / (1024.0 * 1024.0), fullName); + tmp = String.format( + "%5d éléments %7.2f MBytes " + FileSystems.getDefault().getSeparator() + "%s", + folderElementsCount.get(), + ((double) folderElementsRawSize.get()) / (1024.0 * 1024.0), + fullName + ); doProgressLog(storeExtractor.getProgressLogger(), MailExtractProgressLogger.GLOBAL, tmp, null); } else { - doProgressLog(storeExtractor.getProgressLogger(), MailExtractProgressLogger.GLOBAL, FileSystems.getDefault().getSeparator() + fullName, null); + doProgressLog( + storeExtractor.getProgressLogger(), + MailExtractProgressLogger.GLOBAL, + FileSystems.getDefault().getSeparator() + fullName, + null + ); } // extract all subfolders in the folder to the unit directory listSubFolders(stats); @@ -452,8 +465,7 @@ public void listFolder(boolean stats) throws MailExtractLibException, Interrupte private void listFolderElements(boolean stats) throws MailExtractLibException, InterruptedException { folderElementsCount.set(0); folderElementsRawSize.set(0); - if (hasElements()) - doListFolderElements(stats); + if (hasElements()) doListFolderElements(stats); } /** @@ -473,8 +485,7 @@ private void listFolderElements(boolean stats) throws MailExtractLibException, I // encapsulate the subclasses real processing method private void listSubFolders(boolean stats) throws MailExtractLibException, InterruptedException { folderSubFoldersCount.set(0); - if (hasSubfolders()) - doListSubFolders(stats); + if (hasSubfolders()) doListSubFolders(stats); } /** @@ -488,5 +499,4 @@ private void listSubFolders(boolean stats) throws MailExtractLibException, Inter * @throws InterruptedException the interrupted exception */ protected abstract void doListSubFolders(boolean stats) throws MailExtractLibException, InterruptedException; - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java index 1e63ce41..054b7955 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/StoreMessage.java @@ -46,9 +46,6 @@ import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; import fr.gouv.vitam.tools.mailextractlib.utils.RawDataSource; -import org.apache.poi.hmef.Attachment; -import org.apache.poi.hmef.HMEFMessage; - import jakarta.activation.DataHandler; import jakarta.mail.MessagingException; import jakarta.mail.Session; @@ -56,10 +53,11 @@ import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.MimeMultipart; import jakarta.mail.internet.MimeUtility; +import org.apache.poi.hmef.Attachment; +import org.apache.poi.hmef.HMEFMessage; import java.io.*; import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -127,22 +125,22 @@ public abstract class StoreMessage extends StoreElement { /** * The Constant TEXT_BODY. */ - static public final int TEXT_BODY = 0; + public static final int TEXT_BODY = 0; /** * The Constant HTML_BODY. */ - static public final int HTML_BODY = 1; + public static final int HTML_BODY = 1; /** * The Constant RTF_BODY. */ - static public final int RTF_BODY = 2; + public static final int RTF_BODY = 2; /** * The Constant OUT_OF_BODY. */ - static public final int OUT_OF_BODY = 3; + public static final int OUT_OF_BODY = 3; /** * Complete mail header from original smtp format, if any. @@ -286,10 +284,8 @@ public byte[] getMimeContent() { @Override public String getLogDescription() { String result = "message " + listLineId; - if (subject != null) - result += " [" + subject + "]"; - else - result += " [no subject]"; + if (subject != null) result += " [" + subject + "]"; + else result += " [no subject]"; return result; } @@ -400,10 +396,12 @@ protected void detectTNEFAttachment() throws InterruptedException { List newAttachments = new ArrayList<>(); for (StoreAttachment a : attachments) { partialExtraction = false; - if ((a.attachmentType != StoreAttachment.STORE_ATTACHMENT) - && (a.attachmentContent instanceof byte[]) - && ((a.mimeType.toLowerCase().equals("application/ms-tnef") - || (a.mimeType.toLowerCase().equals("application/vnd.ms-tnef"))))) { + if ( + (a.attachmentType != StoreAttachment.STORE_ATTACHMENT) && + (a.attachmentContent instanceof byte[]) && + ((a.mimeType.toLowerCase().equals("application/ms-tnef") || + (a.mimeType.toLowerCase().equals("application/vnd.ms-tnef")))) + ) { try { ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) a.attachmentContent); HMEFMessage tnefPart = new HMEFMessage(bais); @@ -411,28 +409,42 @@ protected void detectTNEFAttachment() throws InterruptedException { String rtfBody = tnefPart.getBody(); List tnefAttachments = tnefPart.getAttachments(); - if ((bodyContent[RTF_BODY] == null) || bodyContent[RTF_BODY].isEmpty()) - bodyContent[RTF_BODY] = rtfBody; - else - logMessageWarning("mailextractlib: redondant rtf body extracted from winmail.dat droped", null); + if ((bodyContent[RTF_BODY] == null) || bodyContent[RTF_BODY].isEmpty()) bodyContent[RTF_BODY] = + rtfBody; + else logMessageWarning( + "mailextractlib: redondant rtf body extracted from winmail.dat droped", + null + ); for (Attachment tnefAttachment : tnefAttachments) { try { - StoreAttachment smAttachment = new StoreAttachment(this, tnefAttachment.getContents(), - "file", tnefAttachment.getLongFilename(), - null, tnefAttachment.getModifiedDate(), - TikaExtractor.getInstance().getMimeType(tnefAttachment.getContents()), - null, StoreAttachment.FILE_ATTACHMENT); + StoreAttachment smAttachment = new StoreAttachment( + this, + tnefAttachment.getContents(), + "file", + tnefAttachment.getLongFilename(), + null, + tnefAttachment.getModifiedDate(), + TikaExtractor.getInstance().getMimeType(tnefAttachment.getContents()), + null, + StoreAttachment.FILE_ATTACHMENT + ); newAttachments.add(smAttachment); } catch (Exception e) { - logMessageWarning("mailextractlib: can't extract all informations from winmail.dat content, " + - "it will be extracted partially and it will be extracted as a file", e); + logMessageWarning( + "mailextractlib: can't extract all informations from winmail.dat content, " + + "it will be extracted partially and it will be extracted as a file", + e + ); partialExtraction = true; } } if (partialExtraction) newAttachments.add(a); } catch (Exception e) { - logMessageWarning("mailextractlib: can't analyze winmail.dat content, it will be extracted as a file", e); + logMessageWarning( + "mailextractlib: can't analyze winmail.dat content, it will be extracted as a file", + e + ); newAttachments.add(a); } } else newAttachments.add(a); @@ -472,16 +484,14 @@ public void analyzeMessage() throws MailExtractLibException, InterruptedExceptio // header metadata extraction // * special global analyzeSubject(); - if ((subject == null) || subject.isEmpty()) - subject = "[SubjectVide]"; + if ((subject == null) || subject.isEmpty()) subject = "[SubjectVide]"; // header content extraction prepareAnalyze(); // * messageID analyzeMessageID(); - if ((messageID == null) || messageID.isEmpty()) - messageID = "[MessageIDVide]"; + if ((messageID == null) || messageID.isEmpty()) messageID = "[MessageIDVide]"; // * recipients and co analyzeFrom(); @@ -513,12 +523,9 @@ public void analyzeMessage() throws MailExtractLibException, InterruptedExceptio // desencapsulate html and text from rtf private void optimizeBodies() { // get rid of useless beginning and ending spaces, carriage returns... - if (bodyContent[TEXT_BODY] != null) - bodyContent[TEXT_BODY] = bodyContent[TEXT_BODY].trim(); - if (bodyContent[HTML_BODY] != null) - bodyContent[HTML_BODY] = bodyContent[HTML_BODY].trim(); - if (bodyContent[RTF_BODY] != null) - bodyContent[RTF_BODY] = bodyContent[RTF_BODY].trim(); + if (bodyContent[TEXT_BODY] != null) bodyContent[TEXT_BODY] = bodyContent[TEXT_BODY].trim(); + if (bodyContent[HTML_BODY] != null) bodyContent[HTML_BODY] = bodyContent[HTML_BODY].trim(); + if (bodyContent[RTF_BODY] != null) bodyContent[RTF_BODY] = bodyContent[RTF_BODY].trim(); try { // de-encapsulate TEXT and HTML from RTF if defined as encapsulated @@ -533,12 +540,13 @@ private void optimizeBodies() { bodyContent[TEXT_BODY] = result; bodyContent[RTF_BODY] = null; } else { - if (bodyContent[TEXT_BODY].equals(result)) - bodyContent[RTF_BODY] = null; + if (bodyContent[TEXT_BODY].equals(result)) bodyContent[RTF_BODY] = null; } } - } else if (htmlExtractor.isEncapsulatedHTMLinRTF() - && ((bodyContent[HTML_BODY] == null) || bodyContent[HTML_BODY].isEmpty())) { + } else if ( + htmlExtractor.isEncapsulatedHTMLinRTF() && + ((bodyContent[HTML_BODY] == null) || bodyContent[HTML_BODY].isEmpty()) + ) { String result = htmlExtractor.getDeEncapsulateHTMLFromRTF(); if ((result != null) && !result.isEmpty()) { result = result.trim(); @@ -546,7 +554,6 @@ private void optimizeBodies() { bodyContent[RTF_BODY] = null; } } - } } catch (MailExtractLibException e) { doProgressLogIfDebug(getProgressLogger(), "Bodies optimization error", e); @@ -569,10 +576,8 @@ public void listElement(boolean statsFlag) throws InterruptedException, MailExtr if (storeFolder.getStoreExtractor().getOptions().extractMessages) { listLineId = storeFolder.getStoreExtractor().incElementCounter(this.getClass()); analyzeMessage(); - if (statsFlag) - extractMessage(false); + if (statsFlag) extractMessage(false); countMessage(); - } } @@ -593,8 +598,7 @@ public final void extractMessage(boolean writeFlag) throws MailExtractLibExcepti String textContent = null; // create message unit - if ((subject == null) || subject.trim().isEmpty()) - subject = "[Vide]"; + if ((subject == null) || subject.trim().isEmpty()) subject = "[Vide]"; messageNode = new ArchiveUnit(storeFolder.storeExtractor, storeFolder.folderArchiveUnit, "Message", subject); @@ -611,22 +615,27 @@ public final void extractMessage(boolean writeFlag) throws MailExtractLibExcepti messageNode.addMetadata("ReceivedDate", DateRange.getISODateString(receivedDate), false); // reply-to messageID - if ((inReplyToUID != null) && !inReplyToUID.isEmpty()) - messageNode.addMetadata("OriginatingSystemIdReplyTo", inReplyToUID, false); + if ((inReplyToUID != null) && !inReplyToUID.isEmpty()) messageNode.addMetadata( + "OriginatingSystemIdReplyTo", + inReplyToUID, + false + ); // get textContent if TEXT_CONTENT not empty - if ((bodyContent[TEXT_BODY] != null) && !bodyContent[TEXT_BODY].isEmpty()) - textContent = bodyContent[TEXT_BODY]; + if ((bodyContent[TEXT_BODY] != null) && !bodyContent[TEXT_BODY].isEmpty()) textContent = bodyContent[TEXT_BODY]; // get text content from html if no textContent - if ((textContent == null) && (bodyContent[HTML_BODY] != null)) - textContent = HTMLTextExtractor.getInstance().act(bodyContent[HTML_BODY]); + if ((textContent == null) && (bodyContent[HTML_BODY] != null)) textContent = HTMLTextExtractor.getInstance() + .act(bodyContent[HTML_BODY]); // purify textContent and put in metadata if ((textContent != null) && (!textContent.trim().isEmpty())) { - if (getStoreExtractor().options.extractMessageTextFile) - messageNode.addObject(HTMLTextExtractor.getInstance().htmlStringtoString(textContent), messageID + ".txt", - "TextContent", 1); + if (getStoreExtractor().options.extractMessageTextFile) messageNode.addObject( + HTMLTextExtractor.getInstance().htmlStringtoString(textContent), + messageID + ".txt", + "TextContent", + 1 + ); if (getStoreExtractor().options.extractMessageTextMetadata) { messageNode.addLongMetadata("TextContent", textContent, true); } @@ -648,33 +657,38 @@ public final void extractMessage(boolean writeFlag) throws MailExtractLibExcepti logMessageWarning("mailextractlib: can't extract raw content", e); } } - if (mimeContent == null) - mimeContent = "".getBytes(); + if (mimeContent == null) mimeContent = "".getBytes(); // add object binary master except if empty one messageNode.addObject(mimeContent, messageID + ".eml", "BinaryMaster", 1); - if (writeFlag - && storeFolder.getStoreExtractor().getOptions().extractElementsContent) - messageNode.write(); + if (writeFlag && storeFolder.getStoreExtractor().getOptions().extractElementsContent) messageNode.write(); int logLevel; if (getStoreExtractor().isRoot()) { - doProgressLogOneMoreCountedObject(getProgressLogger(), MailExtractProgressLogger.MESSAGE_GROUP, "mailextractlib: %count extracted messages"); + doProgressLogOneMoreCountedObject( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_GROUP, + "mailextractlib: %count extracted messages" + ); logLevel = MailExtractProgressLogger.MESSAGE; - } else - logLevel = MailExtractProgressLogger.MESSAGE_DETAILS; - - doProgressLog(getProgressLogger(), logLevel, "mailextractlib: extracted " + getLogDescription() + - " with SentDate=" + (sentDate == null ? "Unknown sent date" : sentDate.toString()), null); + } else logLevel = MailExtractProgressLogger.MESSAGE_DETAILS; + + doProgressLog( + getProgressLogger(), + logLevel, + "mailextractlib: extracted " + + getLogDescription() + + " with SentDate=" + + (sentDate == null ? "Unknown sent date" : sentDate.toString()), + null + ); // write in csv list if asked for - if (writeFlag - && getStoreExtractor().options.extractElementsList - && getStoreExtractor().canExtractObjectsLists()) - writeToMailsList(); - if (Thread.interrupted()) - throw new InterruptedException("mailextractlib: interrupted"); + if ( + writeFlag && getStoreExtractor().options.extractElementsList && getStoreExtractor().canExtractObjectsLists() + ) writeToMailsList(); + if (Thread.interrupted()) throw new InterruptedException("mailextractlib: interrupted"); } /** @@ -682,7 +696,7 @@ && getStoreExtractor().canExtractObjectsLists()) * * @return the element name */ - static public String getElementName() { + public static String getElementName() { return "messages"; } @@ -691,11 +705,13 @@ static public String getElementName() { * * @param ps the dedicated print stream */ - static public void printGlobalListCSVHeader(PrintStream ps) { + public static void printGlobalListCSVHeader(PrintStream ps) { synchronized (ps) { - ps.println("ID;SentDate;ReceivedDate;FromName;FromAddress;" + - "ToList;Subject;MessageID;" + - "AttachmentList;ReplyTo;Folder;Size;Attached"); + ps.println( + "ID;SentDate;ReceivedDate;FromName;FromAddress;" + + "ToList;Subject;MessageID;" + + "AttachmentList;ReplyTo;Folder;Size;Attached" + ); } } @@ -704,31 +720,24 @@ private void writeToMailsList() throws InterruptedException { synchronized (ps) { try { ps.format("\"%d\";", listLineId); - ps.format("\"%s\";", - (sentDate == null ? "" : DateRange.getISODateString(sentDate))); - ps.format("\"%s\";", - (receivedDate == null ? "" : DateRange.getISODateString(receivedDate))); + ps.format("\"%s\";", (sentDate == null ? "" : DateRange.getISODateString(sentDate))); + ps.format("\"%s\";", (receivedDate == null ? "" : DateRange.getISODateString(receivedDate))); if ((from != null) && !from.isEmpty()) { MetadataPerson p = new MetadataPerson(from); - ps.format("\"%s\";\"%s\";", filterHyphenForCsv(p.fullName), - filterHyphenForCsv(p.identifier)); - } else - ps.print("\"\";\"\";"); - ps.format("\"%s\";", - filterHyphenForCsv(personStringListToIndentifierString(recipientTo))); + ps.format("\"%s\";\"%s\";", filterHyphenForCsv(p.fullName), filterHyphenForCsv(p.identifier)); + } else ps.print("\"\";\"\";"); + ps.format("\"%s\";", filterHyphenForCsv(personStringListToIndentifierString(recipientTo))); ps.format("\"%s\";", filterHyphenForCsv(subject)); ps.format("\"%s\";", filterHyphenForCsv(messageID)); ps.format("\"%s\";", filterHyphenForCsv(attachmentsNamesList())); - if ((replyTo == null) || replyTo.isEmpty()) - ps.format("\"\";"); + if ((replyTo == null) || replyTo.isEmpty()) ps.format("\"\";"); else { MetadataPerson p = new MetadataPerson(replyTo.get(0)); ps.format("\"%s\";", filterHyphenForCsv(p.identifier)); } ps.format("\"%s\";", filterHyphenForCsv(storeFolder.getFullName())); ps.format("\"%d\";", this.getMessageSize()); - if (!storeFolder.getStoreExtractor().isRoot()) - ps.format("\"Attached\""); + if (!storeFolder.getStoreExtractor().isRoot()) ps.format("\"Attached\""); ps.println(); ps.flush(); } catch (Exception e) { @@ -744,10 +753,8 @@ private String personStringListToIndentifierString(List sList) { if (sList != null) { for (String s : sList) { - if (first) - first = false; - else - result += ", "; + if (first) first = false; + else result += ", "; p = new MetadataPerson(s); result += p.identifier; } @@ -761,10 +768,8 @@ private String attachmentsNamesList() { if (attachments != null) { for (StoreAttachment a : attachments) { - if (first) - first = false; - else - result += ", "; + if (first) first = false; + else result += ", "; result += a.getName(); } } @@ -804,7 +809,7 @@ public MimeMessage getMimeFake() throws InterruptedException { } private static void setAddressList(MimeMessage mime, String tag, List addressList) - throws MessagingException, UnsupportedEncodingException { + throws MessagingException, UnsupportedEncodingException { if ((addressList != null) && (!addressList.isEmpty())) { String value = ""; int countline = 0; @@ -814,8 +819,7 @@ private static void setAddressList(MimeMessage mime, String tag, List ad if (countline + tmp.length() > 80) { value += "\n\t"; countline = 1; - } else - countline += tmp.length(); + } else countline += tmp.length(); value += MimeUtility.encodeText(tmp, "UTF-8", "Q") + ","; } value = value.substring(0, value.length() - 1); @@ -829,8 +833,7 @@ private void buildMimeHeader(MimeMessage mime) throws MailExtractLibException { if ((mailHeader != null) && (mailHeader.size() > 0)) { String tag, value; for (String tmp : mailHeader) { - if (tmp.indexOf(':') < 0) - continue; + if (tmp.indexOf(':') < 0) continue; tag = tmp.substring(0, tmp.indexOf(':')); value = tmp.substring(tmp.indexOf(':') + 1); mime.setHeader(tag, value); @@ -838,35 +841,28 @@ private void buildMimeHeader(MimeMessage mime) throws MailExtractLibException { } // Return-Path - if (returnPath != null) - mime.setHeader("Return-Path", MimeUtility.encodeText(returnPath, "UTF-8", "Q")); + if (returnPath != null) mime.setHeader("Return-Path", MimeUtility.encodeText(returnPath, "UTF-8", "Q")); // From - if (from != null) - mime.setHeader("From", MimeUtility.encodeText(from, "UTF-8", "Q")); + if (from != null) mime.setHeader("From", MimeUtility.encodeText(from, "UTF-8", "Q")); // To - if (recipientTo != null) - setAddressList(mime, "To", recipientTo); + if (recipientTo != null) setAddressList(mime, "To", recipientTo); // cc - if (recipientCc != null) - setAddressList(mime, "cc", recipientCc); + if (recipientCc != null) setAddressList(mime, "cc", recipientCc); // bcc - if (recipientBcc != null) - setAddressList(mime, "bcc", recipientBcc); + if (recipientBcc != null) setAddressList(mime, "bcc", recipientBcc); // Reply-To - if (replyTo != null) - setAddressList(mime, "Reply-To", replyTo); + if (replyTo != null) setAddressList(mime, "Reply-To", replyTo); // Date, if null Date is deleted mime.setSentDate(sentDate); // Subject - if (subject != null) - mime.setSubject(MimeUtility.encodeText(subject, "UTF-8", "Q")); + if (subject != null) mime.setSubject(MimeUtility.encodeText(subject, "UTF-8", "Q")); // Message-ID - if (messageID != null) - mime.setHeader("Message-ID", MimeUtility.encodeText(messageID, "UTF-8", "Q")); + if (messageID != null) mime.setHeader("Message-ID", MimeUtility.encodeText(messageID, "UTF-8", "Q")); // In-Reply-To - if ((inReplyToUID != null) && (!inReplyToUID.isEmpty())) - mime.setHeader("In-Reply-To", MimeUtility.encodeText(inReplyToUID, "UTF-8", "Q")); - + if ((inReplyToUID != null) && (!inReplyToUID.isEmpty())) mime.setHeader( + "In-Reply-To", + MimeUtility.encodeText(inReplyToUID, "UTF-8", "Q") + ); } catch (MessagingException | UnsupportedEncodingException e) { throw new MailExtractLibException("Unable to generate mime header of message " + subject, e); } @@ -885,18 +881,16 @@ private void addAttachmentPart(MimeMultipart root, boolean isInline) throws Mail String cidName; if ((a.contentID != null) && !a.contentID.trim().isEmpty()) { attachPart.setContentID("<" + a.contentID.trim() + ">"); - if (a.contentID.indexOf('@') < 0) - cidName = a.contentID; - else - cidName = a.contentID.substring(0, a.contentID.indexOf('@')); - } else - cidName = "unknown"; + if (a.contentID.indexOf('@') < 0) cidName = a.contentID; + else cidName = a.contentID.substring(0, a.contentID.indexOf('@')); + } else cidName = "unknown"; // set object and Content-Type String attachmentFilename = encodedFilename(a.name, a.mimeType, cidName); - if ((a.mimeType == null) || (a.mimeType.isEmpty())) - attachPart.setContent(a.getRawAttachmentContent(), - "application/octet-stream; name=\"" + attachmentFilename + "\""); + if ((a.mimeType == null) || (a.mimeType.isEmpty())) attachPart.setContent( + a.getRawAttachmentContent(), + "application/octet-stream; name=\"" + attachmentFilename + "\"" + ); else { if (a.mimeType.startsWith("text")) { String s; @@ -904,32 +898,40 @@ private void addAttachmentPart(MimeMultipart root, boolean isInline) throws Mail attachPart.setContent(s, a.mimeType + "; name=\"" + attachmentFilename + "\""); } else if (a.mimeType.startsWith("message")) { // bypass datahandler as the rfc822 form is provided - RawDataSource rds = new RawDataSource(a.getRawAttachmentContent(), a.mimeType, - attachmentFilename); + RawDataSource rds = new RawDataSource( + a.getRawAttachmentContent(), + a.mimeType, + attachmentFilename + ); DataHandler dh = new DataHandler(rds); attachPart.setDataHandler(dh); } else if (a.mimeType.startsWith("multipart")) { // wrong attachment type corrected to neutral application/octet-stream - attachPart.setContent(a.getRawAttachmentContent(), - "application/octet-stream; name=\"" + attachmentFilename + "\""); + attachPart.setContent( + a.getRawAttachmentContent(), + "application/octet-stream; name=\"" + attachmentFilename + "\"" + ); } else { - attachPart.setContent(a.getRawAttachmentContent(), - a.mimeType + "; name=\"" + attachmentFilename + "\""); + attachPart.setContent( + a.getRawAttachmentContent(), + a.mimeType + "; name=\"" + attachmentFilename + "\"" + ); } } // set Content-Disposition - if (a.attachmentType == StoreAttachment.INLINE_ATTACHMENT) - attachPart.setDisposition("inline; filename=\"" + attachmentFilename + "\""); - else - attachPart.setDisposition("attachment; filename=\"" + attachmentFilename + "\""); + if (a.attachmentType == StoreAttachment.INLINE_ATTACHMENT) attachPart.setDisposition( + "inline; filename=\"" + attachmentFilename + "\"" + ); + else attachPart.setDisposition("attachment; filename=\"" + attachmentFilename + "\""); root.addBodyPart(attachPart); } } } catch (MessagingException | UnsupportedEncodingException e) { throw new MailExtractLibException( - "Unable to generate " + (isInline ? "inlines" : "attachments") + " of message " + subject, e); + "Unable to generate " + (isInline ? "inlines" : "attachments") + " of message " + subject, + e + ); } - } private MimeMultipart newChild(MimeMultipart parent, String type) throws MessagingException { @@ -942,12 +944,9 @@ private MimeMultipart newChild(MimeMultipart parent, String type) throws Messagi // some extraction has no body only headers private boolean isEmptyBodies() { - if ((bodyContent[TEXT_BODY] != null) && !bodyContent[TEXT_BODY].isEmpty()) - return false; - if ((bodyContent[HTML_BODY] != null) && !bodyContent[HTML_BODY].isEmpty()) - return false; - if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) - return false; + if ((bodyContent[TEXT_BODY] != null) && !bodyContent[TEXT_BODY].isEmpty()) return false; + if ((bodyContent[HTML_BODY] != null) && !bodyContent[HTML_BODY].isEmpty()) return false; + if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) return false; // if (attachments.size() > 0) // return false; return true; @@ -969,10 +968,8 @@ private void buildMimePart(MimeMessage mime) throws MailExtractLibException { } // determine in which part to add related - if ((bodyContent[HTML_BODY] != null) && !bodyContent[HTML_BODY].isEmpty()) - relatedPart = HTML_BODY; - else if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) - relatedPart = RTF_BODY; + if ((bodyContent[HTML_BODY] != null) && !bodyContent[HTML_BODY].isEmpty()) relatedPart = HTML_BODY; + else if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) relatedPart = RTF_BODY; // build message part MimeMultipart msgMp = newChild(rootMp, "alternative"); @@ -993,31 +990,26 @@ else if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) MimeMultipart upperpart; if (hasInline && (relatedPart == HTML_BODY)) { upperpart = newChild(msgMp, "related"); - } else - upperpart = msgMp; + } else upperpart = msgMp; MimeBodyPart part = new MimeBodyPart(); part.setContent(bodyContent[HTML_BODY], "text/html; charset=utf-8"); upperpart.addBodyPart(part); - if (hasInline && (relatedPart == HTML_BODY)) - addAttachmentPart(upperpart, true); + if (hasInline && (relatedPart == HTML_BODY)) addAttachmentPart(upperpart, true); } if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) { MimeMultipart upperpart; if (hasInline && (relatedPart == RTF_BODY)) { upperpart = newChild(msgMp, "related"); - } else - upperpart = msgMp; + } else upperpart = msgMp; MimeBodyPart part = new MimeBodyPart(); - part.setContent(bodyContent[RTF_BODY], "text/rtf; charset=US-ASCII");// ; + part.setContent(bodyContent[RTF_BODY], "text/rtf; charset=US-ASCII"); // ; // charset=utf-8"); upperpart.addBodyPart(part); - if (hasInline && (relatedPart == RTF_BODY)) - addAttachmentPart(upperpart, true); - + if (hasInline && (relatedPart == RTF_BODY)) addAttachmentPart(upperpart, true); } } } catch (MessagingException e) { @@ -1025,8 +1017,7 @@ else if ((bodyContent[RTF_BODY] != null) && !bodyContent[RTF_BODY].isEmpty()) } // add inline part of attachments if not added to HTML body - if (relatedPart == OUT_OF_BODY) - addAttachmentPart(rootMp, true); + if (relatedPart == OUT_OF_BODY) addAttachmentPart(rootMp, true); addAttachmentPart(rootMp, false); try { @@ -1041,19 +1032,14 @@ private static boolean isPureAscii(String v) { return StandardCharsets.US_ASCII.newEncoder().canEncode(v); } - private String encodedFilename(String filename, String mimetype, String ifnone) { String tmp; - if ((filename != null) && !filename.trim().isEmpty()) - tmp = filename; - else - tmp = ifnone; - if ("message/rfc822".equals(mimetype) && (!tmp.endsWith(".eml"))) - tmp += ".eml"; + if ((filename != null) && !filename.trim().isEmpty()) tmp = filename; + else tmp = ifnone; + if ("message/rfc822".equals(mimetype) && (!tmp.endsWith(".eml"))) tmp += ".eml"; // prevent a bug when quotes are in ascii filename (encodeWord is then not encoding) - if (isPureAscii(tmp) && tmp.contains("\"")) - tmp = tmp.replaceAll("\"", "'"); + if (isPureAscii(tmp) && tmp.contains("\"")) tmp = tmp.replaceAll("\"", "'"); try { return MimeUtility.encodeWord(tmp, "UTF-8", "Q"); @@ -1089,8 +1075,7 @@ protected void updateMessageID() throws MessagingException { protected synchronized void updateHeaders() throws MessagingException { String[] date = getHeader("Date"); super.updateHeaders(); - if (date == null) - removeHeader("Date"); + if (date == null) removeHeader("Date"); } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java index ef6f1882..f90052b9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/core/package-info.java @@ -47,4 +47,4 @@ *

  • apache POI HSMF to access msg files.
  • * */ -package fr.gouv.vitam.tools.mailextractlib.core; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.core; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java index dd5fde4d..54c56df2 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/HTMLTextExtractor.java @@ -62,12 +62,12 @@ * @author Jonathan Hedley, jonathan@hedley.net */ public class HTMLTextExtractor { + /** Singleton instance **/ private static HTMLTextExtractor INSTANCE = new HTMLTextExtractor(); /** Private constructor */ - private HTMLTextExtractor() { - } + private HTMLTextExtractor() {} /** * Get the HTMLTextExtractor singleton. @@ -89,8 +89,7 @@ public String act(String html) { String result; Element element; - if (html == null) - return ""; + if (html == null) return ""; element = Jsoup.parse(html); @@ -112,8 +111,7 @@ public String act(String html) { public String htmlStringtoString(String in) { String result; - if (in == null) - result = ""; + if (in == null) result = ""; else { // unescape all HTML entities, multiple times if needed result = in; @@ -121,59 +119,52 @@ public String htmlStringtoString(String in) { in = result; result = Parser.unescapeEntities(in, true); } while (!result.equals(in)); - } return result; } - } // the formatting rules, implemented in a breadth-first DOM traverse final class FormattingVisitor implements NodeVisitor { + private static final int maxWidth = 80; private int width = 0; private StringBuilder accum = new StringBuilder(); // holds the + // accumulated text // hit when the node is first seen public void head(Node node, int depth) { String name = node.nodeName(); - if (node instanceof TextNode) - append(((TextNode) node).text()); // TextNodes carry all - // user-readable text in the - // DOM. - else if (name.equals("li")) - append("\n * "); - else if (name.equals("dt")) - append(" "); - else if (StringUtil.in(name, "p", "h1", "h2", "h3", "h4", "h5", "tr")) - append("\n"); + if (node instanceof TextNode) append(((TextNode) node).text()); // TextNodes carry all + // user-readable text in the + // DOM. + else if (name.equals("li")) append("\n * "); + else if (name.equals("dt")) append(" "); + else if (StringUtil.in(name, "p", "h1", "h2", "h3", "h4", "h5", "tr")) append("\n"); } // hit when all of the node's children (if any) have been visited public void tail(Node node, int depth) { String name = node.nodeName(); - if (StringUtil.in(name, "br", "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5")) - append("\n"); - else if (name.equals("a")) - append(String.format("<%s>", node.absUrl("href"))); + if (StringUtil.in(name, "br", "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5")) append("\n"); + else if (name.equals("a")) append(String.format("<%s>", node.absUrl("href"))); } // appends text to the string builder with a simple word wrap method private void append(String text) { - if (text.startsWith("\n")) - width = 0; // reset counter if starts with a newline. only from + if (text.startsWith("\n")) width = 0; // reset counter if starts with a newline. only from // formats above, not in natural text - if (text.equals(" ") && (accum.length() == 0 || StringUtil.in(accum.substring(accum.length() - 1), " ", "\n"))) - return; // don't accumulate long runs of empty spaces + if ( + text.equals(" ") && (accum.length() == 0 || StringUtil.in(accum.substring(accum.length() - 1), " ", "\n")) + ) return; // don't accumulate long runs of empty spaces if (text.length() + width > maxWidth) { // won't fit, needs to wrap String words[] = text.split("\\s+"); for (int i = 0; i < words.length; i++) { String word = words[i]; boolean last = i == words.length - 1; - if (!last) // insert a space if not the last word - word = word + " "; + if (!last) word = word + " "; // insert a space if not the last word if (word.length() + width > maxWidth) { // wrap and reset // counter accum.append("\n").append(word); diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java index 65917acd..888bb060 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/TikaExtractor.java @@ -62,8 +62,7 @@ public TikaExtractor() { logger = Logger.getGlobal(); memLevel = logger.getLevel(); - if (memLevel != Level.FINEST) - logger.setLevel(Level.OFF); + if (memLevel != Level.FINEST) logger.setLevel(Level.OFF); tika = new Tika(); logger.setLevel(memLevel); } @@ -74,8 +73,7 @@ public TikaExtractor() { * @return single instance of FileTextExtractor */ public static TikaExtractor getInstance() { - if (INSTANCE==null) - INSTANCE=new TikaExtractor(); + if (INSTANCE == null) INSTANCE = new TikaExtractor(); return INSTANCE; } @@ -95,11 +93,9 @@ public String extractTextFromBinary(byte[] rawContent) throws MailExtractLibExce logger = Logger.getGlobal(); memLevel = logger.getLevel(); - if (memLevel != Level.FINEST) - logger.setLevel(Level.OFF); + if (memLevel != Level.FINEST) logger.setLevel(Level.OFF); try { - if (rawContent.length > 0) - s = tika.parseToString(new ByteArrayInputStream(rawContent)); + if (rawContent.length > 0) s = tika.parseToString(new ByteArrayInputStream(rawContent)); } catch (Throwable e) { throw new MailExtractLibException("mailextractlib.formattools: can't extract text content", e); } finally { @@ -126,8 +122,7 @@ public String getMimeType(byte[] rawContent) throws MailExtractLibException { if (rawContent.length > 0) { logger = Logger.getGlobal(); memLevel = logger.getLevel(); - if (memLevel != Level.FINEST) - logger.setLevel(Level.OFF); + if (memLevel != Level.FINEST) logger.setLevel(Level.OFF); try { result = tika.detect(rawContent); } catch (Exception e) { @@ -138,5 +133,4 @@ public String getMimeType(byte[] rawContent) throws MailExtractLibException { } return result; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java index 15b02b6f..c898d04f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/package-info.java @@ -41,4 +41,4 @@ *

    * Use Tika library (https://tika.apache.org/) */ -package fr.gouv.vitam.tools.mailextractlib.formattools; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.formattools; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java index 9d17b816..94f325e7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/CharsetUtils.java @@ -61,20 +61,15 @@ */ public class CharsetUtils { - private static final Pattern CHARSET_NAME_PATTERN = - Pattern.compile("[ \\\"]*([^ >,;\\\"]+).*"); + private static final Pattern CHARSET_NAME_PATTERN = Pattern.compile("[ \\\"]*([^ >,;\\\"]+).*"); - private static final Pattern ISO_NAME_PATTERN = - Pattern.compile(".*8859-(\\d+)"); + private static final Pattern ISO_NAME_PATTERN = Pattern.compile(".*8859-(\\d+)"); - private static final Pattern CP_NAME_PATTERN = - Pattern.compile("cp-(\\d+)"); + private static final Pattern CP_NAME_PATTERN = Pattern.compile("cp-(\\d+)"); - private static final Pattern WIN_NAME_PATTERN = - Pattern.compile("win-?(\\d+)"); + private static final Pattern WIN_NAME_PATTERN = Pattern.compile("win-?(\\d+)"); - private static final Map COMMON_CHARSETS = - new HashMap(); + private static final Map COMMON_CHARSETS = new HashMap(); private static Method getCharsetICU = null; private static Method isSupportedICU = null; @@ -97,19 +92,39 @@ private static Map initCommonCharsets(String... names) { static { initCommonCharsets( - "Big5", - "EUC-JP", "EUC-KR", "x-EUC-TW", - "GB18030", - "IBM855", "IBM866", - "ISO-2022-CN", "ISO-2022-JP", "ISO-2022-KR", - "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", - "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", - "ISO-8859-9", "ISO-8859-11", "ISO-8859-13", "ISO-8859-15", - "KOI8-R", - "x-MacCyrillic", - "SHIFT_JIS", - "UTF-8", "UTF-16BE", "UTF-16LE", - "windows-1251", "windows-1252", "windows-1253", "windows-1255"); + "Big5", + "EUC-JP", + "EUC-KR", + "x-EUC-TW", + "GB18030", + "IBM855", + "IBM866", + "ISO-2022-CN", + "ISO-2022-JP", + "ISO-2022-KR", + "ISO-8859-1", + "ISO-8859-2", + "ISO-8859-3", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-6", + "ISO-8859-7", + "ISO-8859-8", + "ISO-8859-9", + "ISO-8859-11", + "ISO-8859-13", + "ISO-8859-15", + "KOI8-R", + "x-MacCyrillic", + "SHIFT_JIS", + "UTF-8", + "UTF-16BE", + "UTF-16LE", + "windows-1251", + "windows-1252", + "windows-1253", + "windows-1255" + ); // Common aliases/typos not included in standard charset definitions COMMON_CHARSETS.put("iso-8851-1", COMMON_CHARSETS.get("iso-8859-1")); @@ -119,10 +134,8 @@ private static Map initCommonCharsets(String... names) { // See if we can load the icu4j CharsetICU class Class icuCharset = null; try { - icuCharset = CharsetUtils.class.getClassLoader().loadClass( - "com.ibm.icu.charset.CharsetICU"); - } catch (ClassNotFoundException ignored) { - } + icuCharset = CharsetUtils.class.getClassLoader().loadClass("com.ibm.icu.charset.CharsetICU"); + } catch (ClassNotFoundException ignored) {} if (icuCharset != null) { try { getCharsetICU = icuCharset.getMethod("forNameICU", String.class); @@ -131,8 +144,7 @@ private static Map initCommonCharsets(String... names) { } try { isSupportedICU = icuCharset.getMethod("isSupported", String.class); - } catch (Throwable ignored) { - } + } catch (Throwable ignored) {} } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java index a265ff0b..628202f7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/HTMLFromRTFExtractor.java @@ -396,13 +396,11 @@ private void processGroupStart() throws IOException { // Pop current GroupState private void processGroupEnd() { // delete any output till in header - if (globalInHeader) - resultBuilder.setLength(0); + if (globalInHeader) resultBuilder.setLength(0); globalAnsiSkip = 0; // Restore group state: globalGroupState = globalGroupState.getPreviousGroupState(); - } // Parse a rtf control token (\...) @@ -446,40 +444,36 @@ private void parseHexChar() throws IOException { // escape: globalAnsiSkip--; } else { - if (!globalGroupState.ignore) - // Unescape: - addOutputByte(16 * hexValue(hex1) + hexValue(hex2)); + if (!globalGroupState.ignore) addOutputByte(16 * hexValue(hex1) + hexValue(hex2)); // Unescape: } } // Parse a rtf control word (\... not escaped character) private void parseControlWord(int firstChar) throws IOException { StringBuilder controlWord = new StringBuilder(); - ; - controlWord.append((char) firstChar); + int b = pbis.read(); while (isAlpha(b)) { controlWord.append((char) b); b = pbis.read(); } - boolean hasParam = false; + boolean negParam = false; if (b == '-') { negParam = true; hasParam = true; b = pbis.read(); } - int param = 0; + while (isDigit(b)) { param *= 10; param += (b - '0'); hasParam = true; b = pbis.read(); } - // space is consumed as part of the // control word, but is not added to the control word if (b != ' ') { @@ -491,9 +485,7 @@ private void parseControlWord(int firstChar) throws IOException { param = -param; } processControlWord(controlWord.toString(), param); - } else - processNoParamControlWord(controlWord.toString()); - + } else processNoParamControlWord(controlWord.toString()); } // Handle non-parameter control word @@ -517,8 +509,8 @@ private void processNoParamControlWord(String controlWord) { case "sect": case "sectd": case "plain": - //case "ltrch": - //case "rtlch": + //case "ltrch": + //case "rtlch": globalInHeader = false; default: // ignore others colortbl stylesheet fonttbl listtable @@ -589,10 +581,8 @@ private void processControlWord(String controlWord, int param) { break; case "htmlrtf": pushText(); - if (param == 0) - globalGroupState.setInHtmlrtf(false); - else - globalGroupState.setInHtmlrtf(true); + if (param == 0) globalGroupState.setInHtmlrtf(false); + else globalGroupState.setInHtmlrtf(true); break; case "f": // Change current font @@ -730,7 +720,6 @@ private void addOutputChar(char ch) { // else appends the characters to the pendingBuffer private void pushPendingBytes() { if (pendingByteCount > 0 && !globalGroupState.ignore) { - final CharsetDecoder decoder = getDecoder(); pendingByteBuffer.limit(pendingByteCount); assert pendingByteBuffer.position() == 0; @@ -834,8 +823,7 @@ private boolean detectEncapsulatedHTMLorTEXTinRTF() { try { while (len < 100) { inc = pbis.read(buf, len, 100 - len); - if (inc == -1) - return false; + if (inc == -1) return false; len += inc; } test = new String(buf); @@ -851,8 +839,7 @@ private boolean detectEncapsulatedHTMLorTEXTinRTF() { if (test.indexOf("\\fromtext") >= 0) { isText = true; return true; - } else - return false; + } else return false; } // public functions @@ -896,15 +883,14 @@ public String getDeEncapsulateHTMLFromRTF() throws MailExtractLibException { if (m.find()) { // add a meta tag to say it's UTF-8 just after tag resultString = resultBuilder - .insert(m.end(), - "\n") - .toString(); + .insert(m.end(), "\n") + .toString(); } else { // add a meta tag to say it's UTF-8 at the beginning (a bit // trash) resultString = resultBuilder - .insert(0, "\n") - .toString(); + .insert(0, "\n") + .toString(); } } @@ -913,5 +899,4 @@ public String getDeEncapsulateHTMLFromRTF() throws MailExtractLibException { return resultString; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java index 2493a51c..a3743c0b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/RTFGroupState.java @@ -141,5 +141,4 @@ public void setInHtmlrtf(boolean b) { public RTFGroupState getPreviousGroupState() { return previous; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java index a358723e..a2a3a6b7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/formattools/rtf/package-info.java @@ -41,4 +41,4 @@ * Conform with MSDN directives to de-encapsulate HTML from RTF * https://msdn.microsoft.com/en-us/library/ee159984(v=exchg.80).aspx */ -package fr.gouv.vitam.tools.mailextractlib.formattools.rtf; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.formattools.rtf; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java index e1b1eb9c..769432f8 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/ArchiveUnit.java @@ -63,6 +63,7 @@ * All the files, if not pure binary, are UTF-8 encoded, as the file names. */ public class ArchiveUnit { + private StoreExtractor storeExtractor; private String rootPath; private String name; @@ -72,6 +73,7 @@ public class ArchiveUnit { // Utility class containing one Object of the ObjectGroup private class ArchiveObject { + /** * The Filename. */ @@ -134,12 +136,10 @@ public ArchiveUnit(StoreExtractor storeExtractor, String rootPath, String name) */ public ArchiveUnit(StoreExtractor storeExtractor, ArchiveUnit father, String unitType, String name) { this.storeExtractor = storeExtractor; - if (unitType == null) - this.name = name; + if (unitType == null) this.name = name; else { this.name = this.normalizeUniqUnitname(unitType, name); - if (unitType.equals("Message")) - forceMessageUnit = true; + if (unitType.equals("Message")) forceMessageUnit = true; } this.rootPath = father.getFullName(); } @@ -191,13 +191,10 @@ public void setObjectUnit(boolean b) { * @return Name of Archive Unit in directory name */ public String getName() { - if (!forceMessageUnit && (objects.isEmpty())) - return name; + if (!forceMessageUnit && (objects.isEmpty())) return name; else { - if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) - return "__" + name + "__"; - else - return name; + if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) return "__" + name + "__"; + else return name; } } @@ -214,11 +211,19 @@ public String getName() { * @throws InterruptedException the interrupted exception */ public void addMetadata(String key, String value, boolean mandatory) throws InterruptedException { - if (value != null && !value.isEmpty()) - contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, value)); - else if (mandatory) - doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' empty in unit '" + name + "' in folder '" - + rootPath + "'", null); + if (value != null && !value.isEmpty()) contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, value)); + else if (mandatory) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' empty in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } /** @@ -238,9 +243,18 @@ else if (mandatory) public void addLongMetadata(String key, String value, boolean mandatory) throws InterruptedException { if (value != null && !value.isEmpty()) { contentmetadatalist.addMetadataXMLNode(new MetadataXMLSplittedNode(key, value)); - } else if (mandatory) - doProgressLog(getProgressLogger(),MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' empty in unit '" + name + "' in folder '" - + rootPath + "'", null); + } else if (mandatory) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' empty in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } /** @@ -257,12 +271,24 @@ public void addLongMetadata(String key, String value, boolean mandatory) throws * @param mandatory Mandatory flag * @throws InterruptedException the interrupted exception */ - public void addMetadata(String key, String attributename, String attributevalue, String value, boolean mandatory) throws InterruptedException { - if (value != null && !value.isEmpty()) - contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, attributename, attributevalue, value)); + public void addMetadata(String key, String attributename, String attributevalue, String value, boolean mandatory) + throws InterruptedException { + if (value != null && !value.isEmpty()) contentmetadatalist.addMetadataXMLNode( + new MetadataXMLNode(key, attributename, attributevalue, value) + ); else if (mandatory) { - doProgressLog(getProgressLogger(),MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' is not defined in unit '" + name - + "' in folder '" + rootPath + "'", null); + doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' is not defined in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } } @@ -275,10 +301,10 @@ else if (mandatory) { * @param defaultValue Default metadata value */ public void addDefaultValuedMetadata(String key, String value, String defaultValue) { - if ((value != null) && !value.isEmpty()) - contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, value)); - else - contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, defaultValue)); + if ((value != null) && !value.isEmpty()) contentmetadatalist.addMetadataXMLNode( + new MetadataXMLNode(key, value) + ); + else contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, defaultValue)); } /** @@ -295,14 +321,24 @@ public void addDefaultValuedMetadata(String key, String value, String defaultVal * @param mandatory Mandatory flag * @throws InterruptedException the interrupted exception */ - public void addSameMetadataList(String key, List valuesList, boolean mandatory) throws InterruptedException { + public void addSameMetadataList(String key, List valuesList, boolean mandatory) + throws InterruptedException { if ((valuesList != null) && (!valuesList.isEmpty())) { for (String s : valuesList) { contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, s)); } - } else if (mandatory) - doProgressLog(getProgressLogger(),MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' empty in unit '" + name + "' in folder '" - + rootPath + "'", null); + } else if (mandatory) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' empty in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } /** @@ -335,9 +371,18 @@ public void addPersonMetadata(String key, String value, boolean mandatory) throw mvMetaData = new MetadataXMLNode("Identifier", p.identifier); mlMetaData.addMetadataXMLNode(mvMetaData); contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, mlMetaData)); - } else if (mandatory) - doProgressLog(getProgressLogger(),MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' empty in unit '" + name + "' in folder '" - + rootPath + "'", null); + } else if (mandatory) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' empty in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } /** @@ -385,7 +430,8 @@ public void addEventMetadata(String identifier, String type, String dateTime, St * @param mandatory Mandatory flag * @throws InterruptedException the interrupted exception */ - public void addPersonMetadataList(String key, List valuesList, boolean mandatory) throws InterruptedException { + public void addPersonMetadataList(String key, List valuesList, boolean mandatory) + throws InterruptedException { MetadataPerson p; MetadataXMLNode mvMetaData; MetadataXMLList mlMetaData; @@ -400,9 +446,18 @@ public void addPersonMetadataList(String key, List valuesList, boolean m mlMetaData.addMetadataXMLNode(mvMetaData); contentmetadatalist.addMetadataXMLNode(new MetadataXMLNode(key, mlMetaData)); } - } else if (mandatory) - doProgressLog(getProgressLogger(),MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib: mandatory metadata '" + key + "' empty in unit '" + name + "' in folder '" - + rootPath + "'", null); + } else if (mandatory) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib: mandatory metadata '" + + key + + "' empty in unit '" + + name + + "' in folder '" + + rootPath + + "'", + null + ); } /** @@ -416,7 +471,14 @@ public void addPersonMetadataList(String key, List valuesList, boolean m * @param version Object version (usually 1) */ public void addObject(String stringContent, String filename, String usage, int version) { - objects.add(new ArchiveObject(stringContent.getBytes(StandardCharsets.UTF_8), normalizeFilename(filename), usage, version)); + objects.add( + new ArchiveObject( + stringContent.getBytes(StandardCharsets.UTF_8), + normalizeFilename(filename), + usage, + version + ) + ); } /** @@ -439,7 +501,14 @@ private void createDirectory(String dirname) throws MailExtractLibException { synchronized (storeExtractor.getRootStoreExtractor()) { File dir = new File(dirname); if (!dir.isDirectory() && !dir.mkdirs()) { - throw new MailExtractLibException("mailextractlib: can't create destination directory[" + dirname + "] for writing unit \"" + name + "\"", null); + throw new MailExtractLibException( + "mailextractlib: can't create destination directory[" + + dirname + + "] for writing unit \"" + + name + + "\"", + null + ); } } } @@ -447,16 +516,30 @@ private void createDirectory(String dirname) throws MailExtractLibException { // create a file from byte array private void writeFile(String dirPath, String filename, byte[] byteContent) throws MailExtractLibException { try (FileOutputStream fos = new FileOutputStream(dirPath + File.separator + filename)) { - if (byteContent != null) - fos.write(byteContent); + if (byteContent != null) fos.write(byteContent); } catch (IOException ex) { if (dirPath.length() + filename.length() > 250) { throw new MailExtractLibException( - "mailextractlib: illegal destination file (may be too long pathname), writing unit \"" + name - + "\"" + " dir=" + dirPath + " filename=" + filename, ex); + "mailextractlib: illegal destination file (may be too long pathname), writing unit \"" + + name + + "\"" + + " dir=" + + dirPath + + " filename=" + + filename, + ex + ); } else { - throw new MailExtractLibException("mailextractlib: illegal destination file, writing unit \"" + name + "\"" - + " dir=" + dirPath + " filename=" + filename, ex); + throw new MailExtractLibException( + "mailextractlib: illegal destination file, writing unit \"" + + name + + "\"" + + " dir=" + + dirPath + + " filename=" + + filename, + ex + ); } } } @@ -480,23 +563,32 @@ public void write() throws MailExtractLibException { MetadataXMLNode contentmetadata = new MetadataXMLNode("Content", contentmetadatalist); // write unit metadata file - if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) - writeFile(dirPath, "ArchiveUnitContent.xml", contentmetadata.writeXML().getBytes(StandardCharsets.UTF_8)); - else - writeFile(dirPath, "__ArchiveUnitMetadata.xml", contentmetadata.writeXML().getBytes(StandardCharsets.UTF_8)); - + if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) writeFile( + dirPath, + "ArchiveUnitContent.xml", + contentmetadata.writeXML().getBytes(StandardCharsets.UTF_8) + ); + else writeFile( + dirPath, + "__ArchiveUnitMetadata.xml", + contentmetadata.writeXML().getBytes(StandardCharsets.UTF_8) + ); // write objects files if (!objects.isEmpty()) { for (ArchiveObject o : objects) { - if (o.filename == null || o.filename.isEmpty()) - filename = "undefined"; - else - filename = o.filename; - if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) - writeFile(dirPath, "__" + o.usage + "_" + Integer.toString(o.version) + "_" + filename, o.rawContent); - else - writeFile(dirPath, "__" + o.usage + "_" + Integer.toString(o.version) + "__" + filename, o.rawContent); + if (o.filename == null || o.filename.isEmpty()) filename = "undefined"; + else filename = o.filename; + if (storeExtractor.getOptions().model == StoreExtractorOptions.MODEL_V1) writeFile( + dirPath, + "__" + o.usage + "_" + Integer.toString(o.version) + "_" + filename, + o.rawContent + ); + else writeFile( + dirPath, + "__" + o.usage + "_" + Integer.toString(o.version) + "__" + filename, + o.rawContent + ); } } } @@ -511,19 +603,15 @@ private String normalizeFilename(String filename) { int lastPoint = filename.lastIndexOf('.'); if (lastPoint != -1) { extension = filename.substring(lastPoint); - if (lastPoint >= 1) - result = filename.substring(0, lastPoint); - else - result = ""; - } else - result = filename; + if (lastPoint >= 1) result = filename.substring(0, lastPoint); + else result = ""; + } else result = filename; len = storeExtractor.getOptions().namesLength + 20; result = result.replaceAll("[^\\p{IsAlphabetic}\\p{Digit}\\.]", "-"); - if (result.length() > len) - result = result.substring(0, len); + if (result.length() > len) result = result.substring(0, len); return result + extension; } @@ -534,18 +622,14 @@ private String normalizeUniqUnitname(String type, String filename) { int len; len = storeExtractor.getOptions().namesLength; - if (len < 32) - type = type.substring(0, 1); + if (len < 32) type = type.substring(0, 1); - if (filename != null) - result = filename.replaceAll("[^\\p{IsAlphabetic}\\p{Digit}]", "-"); + if (filename != null) result = filename.replaceAll("[^\\p{IsAlphabetic}\\p{Digit}]", "-"); - if (result.length() > len) - result = result.substring(0, len); + if (result.length() > len) result = result.substring(0, len); int uniqID = storeExtractor.getNewUniqID(); result = type + "#" + Integer.toString(uniqID) + "-" + result; return result; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java index f7e40b09..688a2675 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataPerson.java @@ -38,6 +38,7 @@ package fr.gouv.vitam.tools.mailextractlib.nodes; import jakarta.mail.internet.MimeUtility; + import java.io.UnsupportedEncodingException; /** @@ -76,26 +77,21 @@ public MetadataPerson(String s) { if (((beg = s.lastIndexOf('<')) != -1) && ((end = s.lastIndexOf('>')) != -1) && (beg < end)) { identifier = s.substring(beg + 1, end).trim(); - if (identifier.isEmpty()) - identifier = "[Vide]"; - } else - identifier = s.trim(); + if (identifier.isEmpty()) identifier = "[Vide]"; + } else identifier = s.trim(); + + if ((end = identifier.indexOf('@')) > 1) name = identifier.substring(0, end); + else name = "[Vide]"; - if ((end = identifier.indexOf('@')) > 1) - name = identifier.substring(0, end); - else - name = "[Vide]"; + if (name.startsWith("=?")) try { + name = MimeUtility.decodeText(name); + } catch (UnsupportedEncodingException e) { + // Don't care + } - if (name.startsWith("=?")) - try { - name = MimeUtility.decodeText(name); - } catch (UnsupportedEncodingException e) { - // Don't care - } + if ((name.charAt(0) == '"') && (name.charAt(name.length() - 1) == '"') && name.length() > 1) name = + name.substring(1, name.length() - 1); - if ((name.charAt(0) == '"') && (name.charAt(name.length() - 1) == '"') && name.length() > 1) - name = name.substring(1, name.length() - 1); - fullName = name.replaceAll("\\.", " "); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java index dcad546b..4bcd113f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXML.java @@ -51,7 +51,7 @@ public abstract class MetadataXML { * * @return true, if is empty */ - abstract public boolean isEmpty(); + public abstract boolean isEmpty(); /** * Write the metadata in XML with pretty print format. @@ -60,7 +60,7 @@ public abstract class MetadataXML { * Depth used for tabulation * @return the string */ - abstract protected String writeXML(int depth); + protected abstract String writeXML(int depth); /** * Generate a depth long repetition of tabs. diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java index b44bcc1b..47b834fa 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLList.java @@ -95,8 +95,6 @@ protected String writeXML(int depth) { * the metadata xml node */ public void addMetadataXMLNode(MetadataXMLNode metadataxmlnode) { - if ((metadataxmlnode != null) && !metadataxmlnode.isEmpty()) - nodelist.add(metadataxmlnode); + if ((metadataxmlnode != null) && !metadataxmlnode.isEmpty()) nodelist.add(metadataxmlnode); } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java index 711f112c..253d098b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLNode.java @@ -68,15 +68,10 @@ protected String writeXML(int depth) { StringBuilder sb = new StringBuilder(); String tabs = depthTabs(depth); - sb.append(tabs) - .append('<').append(tag); + sb.append(tabs).append('<').append(tag); if (attributename != null) { - sb.append(' ') - .append(attributename) - .append("=\"") - .append(attributevalue) - .append('"'); + sb.append(' ').append(attributename).append("=\"").append(attributevalue).append('"'); } sb.append('>'); @@ -84,15 +79,10 @@ protected String writeXML(int depth) { if (value instanceof MetadataXMLString) { sb.append(value.writeXML(depth + 1)); } else { - sb.append('\n') - .append(value.writeXML(depth + 1)) - .append('\n') - .append(tabs); + sb.append('\n').append(value.writeXML(depth + 1)).append('\n').append(tabs); } - sb.append("'); + sb.append("'); return sb.toString(); } @@ -196,5 +186,4 @@ public MetadataXMLNode(String tag, String attributename, String attributevalue, public String writeXML() { return writeXML(0); } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java index 0d9fe4c1..b353bb99 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLSplittedNode.java @@ -37,7 +37,6 @@ */ package fr.gouv.vitam.tools.mailextractlib.nodes; - import fr.gouv.vitam.tools.mailextractlib.utils.HtmlAndXmlEscape; import java.util.regex.Pattern; @@ -85,7 +84,7 @@ private static String normaliseXMLLongString(String value) { // remove all forbidden and invisible characters String normalized = FORBIDDEN_PATTERN.matcher(value).replaceAll(""); // unescape all HMTL characters - normalized= HtmlAndXmlEscape.unescapeHtmlAndXMLEntities(normalized); + normalized = HtmlAndXmlEscape.unescapeHtmlAndXMLEntities(normalized); // break HTML tags in metadata if any normalized = normalized.replace("<", "< "); // break left HTML escape after unescape @@ -124,27 +123,17 @@ protected String writeXML(int depth) { String subValue = normalisedValue.substring(chunkBeg, chunkEnd); // Build the XML output for this chunk - result.append(tabs) - .append('<').append(tag); + result.append(tabs).append('<').append(tag); if (attributename != null) { - result.append(' ') - .append(attributename) - .append("=\"") - .append(attributevalue) - .append("\""); + result.append(' ').append(attributename).append("=\"").append(attributevalue).append("\""); } - result.append('>') - .append(subValue) - .append("\n"); + result.append('>').append(subValue).append("\n"); // Advance to the next segment chunkBeg = chunkEnd; } return result.toString(); - } /** @@ -194,8 +183,7 @@ private static int findCutPosition(String s, int beg, int maxBytesLength) { int lastSpace = -1; int lastReturn = -1; - if ((length - beg) * 3 < maxBytesLength) - return s.length(); + if ((length - beg) * 3 < maxBytesLength) return s.length(); while (i < length) { char c = s.charAt(i); diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java index 0d38fb61..2b91a44f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/MetadataXMLString.java @@ -73,19 +73,17 @@ public boolean isEmpty() { return (value == null) || value.isEmpty(); } - // Vitam XML value sanity check private static final String TAG_START = - "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>"; - private static final String TAG_END = - "\\"; + "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>"; + private static final String TAG_END = "\\"; private static final String TAG_SELF_CLOSING = - "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>"; - private static final String HTML_ENTITY = - "&[a-zA-Z][a-zA-Z0-9]+;"; + "\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>"; + private static final String HTML_ENTITY = "&[a-zA-Z][a-zA-Z0-9]+;"; public static final Pattern HTML_PATTERN = Pattern.compile( - "(" + TAG_START + ".*" + TAG_END + ")|(" + TAG_SELF_CLOSING + ")|(" + HTML_ENTITY + ")", - Pattern.DOTALL); + "(" + TAG_START + ".*" + TAG_END + ")|(" + TAG_SELF_CLOSING + ")|(" + HTML_ENTITY + ")", + Pattern.DOTALL + ); private static final Pattern FORBIDDEN_PATTERN = Pattern.compile("[\\p{C}&&[^\\r\\n\\t]]"); @@ -105,10 +103,10 @@ public static String normaliseXMLString(String value) { // remove all forbidden and invisible characters String normalized = FORBIDDEN_PATTERN.matcher(value).replaceAll(""); // unescape all HMTL characters - normalized= HtmlAndXmlEscape.unescapeHtmlAndXMLEntities(normalized); + normalized = HtmlAndXmlEscape.unescapeHtmlAndXMLEntities(normalized); // break XML tags in metadata if any, based on Vitam sanity check Matcher m = HTML_PATTERN.matcher(normalized); - if (m.find()) { + if (m.find()) { StringBuffer sb = new StringBuffer(); do { String match = m.group(); @@ -117,7 +115,7 @@ public static String normaliseXMLString(String value) { m.appendReplacement(sb, Matcher.quoteReplacement(replacement)); } while (m.find()); m.appendTail(sb); - normalized = sb.toString(); + normalized = sb.toString(); } // suppress and escape all non XML compliance diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java index d260c343..5b9dc08b 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/nodes/package-info.java @@ -39,4 +39,4 @@ * Provides all classes and method to create, manage and edit to disk the * ArchiveUnits with their metadata. The metadata is in XML format on disk. */ -package fr.gouv.vitam.tools.mailextractlib.nodes; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.nodes; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java index 51728ba9..b317344d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMEmbeddedStore.java @@ -41,19 +41,18 @@ * Interface implemented on JavaMail extractor that can to extract embedded message (only eml). */ public interface JMEmbeddedStore { - /** * Sets the object content. * * @param objectContent * the new object content */ - abstract public void setObjectContent(Object objectContent); + public abstract void setObjectContent(Object objectContent); /** * Gets the object content. * * @return the object content */ - abstract public Object getObjectContent(); + public abstract Object getObjectContent(); } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java index b76515f6..165303a9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMMimeMessage.java @@ -40,6 +40,7 @@ import jakarta.mail.Folder; import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; + import java.io.InputStream; /** diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java index 7c54c0d0..e80e3827 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreExtractor.java @@ -47,8 +47,8 @@ import fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird.ThunderbirdStore; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; - import jakarta.mail.*; + import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Properties; @@ -60,6 +60,7 @@ * could also be used for POP3 and Gmail, via StoreExtractor (not tested). */ public class JMStoreExtractor extends StoreExtractor { + private Store store; /** @@ -68,14 +69,14 @@ public class JMStoreExtractor extends StoreExtractor { * This is in default list. */ public static void subscribeStoreExtractor() { - addExtractionRelation("message/rfc822", "fmt/278","eml", false, JMStoreExtractor.class); - addExtractionRelation("message/rfc822", "fmt/950","eml", false, JMStoreExtractor.class); - addExtractionRelation("application/mbox", "fmt/720","mbox", true, JMStoreExtractor.class); - addExtractionRelation(null, null,"thunderbird", true, JMStoreExtractor.class); - addExtractionRelation(null, null,"imap", true, JMStoreExtractor.class); - addExtractionRelation(null, null,"imaps", true, JMStoreExtractor.class); - addExtractionRelation(null, null,"gimap", true, JMStoreExtractor.class); - addExtractionRelation(null, null,"pop3", true, JMStoreExtractor.class); + addExtractionRelation("message/rfc822", "fmt/278", "eml", false, JMStoreExtractor.class); + addExtractionRelation("message/rfc822", "fmt/950", "eml", false, JMStoreExtractor.class); + addExtractionRelation("application/mbox", "fmt/720", "mbox", true, JMStoreExtractor.class); + addExtractionRelation(null, null, "thunderbird", true, JMStoreExtractor.class); + addExtractionRelation(null, null, "imap", true, JMStoreExtractor.class); + addExtractionRelation(null, null, "imaps", true, JMStoreExtractor.class); + addExtractionRelation(null, null, "gimap", true, JMStoreExtractor.class); + addExtractionRelation(null, null, "pop3", true, JMStoreExtractor.class); } // Attachment to complete with decoded form @@ -103,15 +104,19 @@ public static void subscribeStoreExtractor() { * Any unrecoverable extraction exception (access trouble, major * format problems...) */ - public JMStoreExtractor(String urlString, String folder, String destPathString, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, MailExtractProgressLogger logger) throws MailExtractLibException { + public JMStoreExtractor( + String urlString, + String folder, + String destPathString, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + MailExtractProgressLogger logger + ) throws MailExtractLibException { super(urlString, folder, destPathString, options, rootStoreExtractor, null, logger); - String url; url = urlString; - if (folder != null && !folder.isEmpty()) - url += "/" + folder; + if (folder != null && !folder.isEmpty()) url += "/" + folder; try { // Connect to the store @@ -122,17 +127,35 @@ public JMStoreExtractor(String urlString, String folder, String destPathString, Session session = Session.getDefaultInstance(props, null); // add thunderbird provider - session.addProvider(new Provider(Provider.Type.STORE, "thunderbird", + session.addProvider( + new Provider( + Provider.Type.STORE, + "thunderbird", ThunderbirdStore.class.getName(), - "fr.gouv.vitam", getClass().getPackage().getImplementationVersion())); + "fr.gouv.vitam", + getClass().getPackage().getImplementationVersion() + ) + ); // add eml provider - session.addProvider(new Provider(Provider.Type.STORE, "eml", - EmlStore.class.getName(), "fr.gouv.vitam", - getClass().getPackage().getImplementationVersion())); + session.addProvider( + new Provider( + Provider.Type.STORE, + "eml", + EmlStore.class.getName(), + "fr.gouv.vitam", + getClass().getPackage().getImplementationVersion() + ) + ); // add mbox provider - session.addProvider(new Provider(Provider.Type.STORE, "mbox", - MboxStore.class.getName(), "fr.gouv.vitam", - getClass().getPackage().getImplementationVersion())); + session.addProvider( + new Provider( + Provider.Type.STORE, + "mbox", + MboxStore.class.getName(), + "fr.gouv.vitam", + getClass().getPackage().getImplementationVersion() + ) + ); URLName urlName = new URLName(url); store = session.getStore(urlName); @@ -145,18 +168,25 @@ public JMStoreExtractor(String urlString, String folder, String destPathString, JMStoreFolder jMRootMailBoxFolder; try { - if ((folder == null) || folder.isEmpty()) - - jMRootMailBoxFolder = JMStoreFolder.createRootFolder(this, store.getDefaultFolder(), rootNode); - else - jMRootMailBoxFolder = JMStoreFolder.createRootFolder(this, store.getFolder(folder), rootNode); + if ((folder == null) || folder.isEmpty()) jMRootMailBoxFolder = JMStoreFolder.createRootFolder( + this, + store.getDefaultFolder(), + rootNode + ); + else jMRootMailBoxFolder = JMStoreFolder.createRootFolder(this, store.getFolder(folder), rootNode); if (!jMRootMailBoxFolder.folder.exists()) { - throw new MailExtractLibException("mailextractlib.javamail: can't find extraction root folder " + folder, null); + throw new MailExtractLibException( + "mailextractlib.javamail: can't find extraction root folder " + folder, + null + ); } setRootFolder(jMRootMailBoxFolder); } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't find extraction root folder " + folder, e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't find extraction root folder " + folder, + e + ); } } @@ -171,9 +201,23 @@ public JMStoreExtractor(String urlString, String folder, String destPathString, * @param logger logger used * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) */ - public JMStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, StoreElement fatherElement, MailExtractProgressLogger logger) throws MailExtractLibException { - super(attachment.getScheme() + "://localhost/", "", rootNode.getFullName(), options, rootStoreExtractor, fatherElement, logger); + public JMStoreExtractor( + StoreAttachment attachment, + ArchiveUnit rootNode, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + StoreElement fatherElement, + MailExtractProgressLogger logger + ) throws MailExtractLibException { + super( + attachment.getScheme() + "://localhost/", + "", + rootNode.getFullName(), + options, + rootStoreExtractor, + fatherElement, + logger + ); String url; url = attachment.getScheme() + ":"; @@ -187,26 +231,39 @@ public JMStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, StoreE Session session = Session.getDefaultInstance(props, null); // add eml provider - session.addProvider(new Provider(Provider.Type.STORE, "eml", - EmlStore.class.getName(), "fr.gouv.vitam", - getClass().getPackage().getImplementationVersion())); + session.addProvider( + new Provider( + Provider.Type.STORE, + "eml", + EmlStore.class.getName(), + "fr.gouv.vitam", + getClass().getPackage().getImplementationVersion() + ) + ); // add mbox provider - session.addProvider(new Provider(Provider.Type.STORE, "mbox", - MboxStore.class.getName(), "fr.gouv.vitam", - getClass().getPackage().getImplementationVersion())); + session.addProvider( + new Provider( + Provider.Type.STORE, + "mbox", + MboxStore.class.getName(), + "fr.gouv.vitam", + getClass().getPackage().getImplementationVersion() + ) + ); URLName urlName = new URLName(url); store = session.getStore(urlName); if (!(store instanceof JMEmbeddedStore)) { throw new MailExtractLibException( - "mailextractlib.javamail: can't extract embedded store for scheme [" + scheme + "]", null); + "mailextractlib.javamail: can't extract embedded store for scheme [" + scheme + "]", + null + ); } JMEmbeddedStore ejs = (JMEmbeddedStore) store; ejs.setObjectContent(attachment.getStoreContent()); store.connect(); } catch (MessagingException e) { - throw new MailExtractLibException( - "mailextractlib.javamail: can't get store for " + url, e); + throw new MailExtractLibException("mailextractlib.javamail: can't get store for " + url, e); } JMStoreFolder jMRootMailBoxFolder; @@ -252,12 +309,11 @@ public StoreAttachment getAttachment() { return attachment; } - /* (non-Javadoc) * @see fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor#canExtractObjectsLists() */ @Override public boolean canExtractObjectsLists() { - return ! scheme.equals("eml"); + return !scheme.equals("eml"); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java index 7dd5c355..6b8824ca 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreFolder.java @@ -43,7 +43,6 @@ import fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox.MboxFolder; import fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird.ThunderbirdFolder; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; - import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; import jakarta.mail.Flags; import jakarta.mail.Folder; @@ -75,12 +74,11 @@ private JMStoreFolder(StoreExtractor storeExtractor, final Folder folder) { private JMStoreFolder(StoreExtractor storeExtractor, final Folder folder, StoreFolder father) { super(storeExtractor); this.folder = folder; - if (folder instanceof ThunderbirdFolder) - ((ThunderbirdFolder) folder).setLogger(storeExtractor.getProgressLogger()); - else if (folder instanceof MboxFolder) - ((MboxFolder) folder).setLogger(storeExtractor.getProgressLogger()); - if (father != null) - finalizeStoreFolder(father); + if (folder instanceof ThunderbirdFolder) ((ThunderbirdFolder) folder).setLogger( + storeExtractor.getProgressLogger() + ); + else if (folder instanceof MboxFolder) ((MboxFolder) folder).setLogger(storeExtractor.getProgressLogger()); + if (father != null) finalizeStoreFolder(father); } /** @@ -91,8 +89,11 @@ else if (folder instanceof MboxFolder) * @param rootArchiveUnit Root ArchiveUnit * @return the JM store folder */ - public static JMStoreFolder createRootFolder(StoreExtractor storeExtractor, final Folder folder, - ArchiveUnit rootArchiveUnit) { + public static JMStoreFolder createRootFolder( + StoreExtractor storeExtractor, + final Folder folder, + ArchiveUnit rootArchiveUnit + ) { JMStoreFolder result = new JMStoreFolder(storeExtractor, folder); result.folderArchiveUnit = rootArchiveUnit; @@ -137,19 +138,29 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE for (int i = 0; i < submittedTasks; i++) { Future future = completionService.poll(60, TimeUnit.SECONDS); if (future == null) { - throw new MailExtractLibException("mailextractlib.javamail: Timeout: no message extracted within 60 seconds, folder extraction aborted.", null); + throw new MailExtractLibException( + "mailextractlib.javamail: Timeout: no message extracted within 60 seconds, folder extraction aborted.", + null + ); } try { - future.get(); // Retrieve the task result or propagate any exception + future.get(); // Retrieve the task result or propagate any exception } catch (ExecutionException e) { - MailExtractProgressLogger.doProgressLogWithoutInterruption(getStoreExtractor().getProgressLogger(), - MailExtractProgressLogger.MESSAGE, - "mailextractlib.javamail: Error during a message processing, it's dropped.", e); + MailExtractProgressLogger.doProgressLogWithoutInterruption( + getStoreExtractor().getProgressLogger(), + MailExtractProgressLogger.MESSAGE, + "mailextractlib.javamail: Error during a message processing, it's dropped.", + e + ); } } } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: cannot retrieve messages from folder " - + getFullName() + ", folder extraction aborted", e); + throw new MailExtractLibException( + "mailextractlib.javamail: cannot retrieve messages from folder " + + getFullName() + + ", folder extraction aborted", + e + ); } finally { pool.shutdownNow(); } @@ -166,7 +177,10 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE } folder.close(false); } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't get messages from folder " + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't get messages from folder " + getFullName(), + e + ); } } } @@ -179,20 +193,22 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE * int, boolean) */ @Override - protected void doExtractSubFolders(int level, boolean writeFlag) throws MailExtractLibException, InterruptedException { + protected void doExtractSubFolders(int level, boolean writeFlag) + throws MailExtractLibException, InterruptedException { JMStoreFolder mBSubFolder; try { final Folder[] subfolders = folder.list(); for (final Folder subfolder : subfolders) { - mBSubFolder = new JMStoreFolder(storeExtractor, subfolder, this); - if (mBSubFolder.extractFolder(level + 1, writeFlag)) - incFolderSubFoldersCount(); + if (mBSubFolder.extractFolder(level + 1, writeFlag)) incFolderSubFoldersCount(); extendDateRange(mBSubFolder.getDateRange()); } } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't get sub folders from folder " + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't get sub folders from folder " + getFullName(), + e + ); } } @@ -226,7 +242,10 @@ public boolean hasElements() throws MailExtractLibException { try { return (folder.getType() & Folder.HOLDS_MESSAGES) != 0; } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't determine if folder contains messages" + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't determine if folder contains messages" + getFullName(), + e + ); } } @@ -240,7 +259,10 @@ public boolean hasSubfolders() throws MailExtractLibException { try { return (folder.getType() & Folder.HOLDS_FOLDERS) != 0; } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't determine if folder contains subfolders" + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't determine if folder contains subfolders" + getFullName(), + e + ); } } @@ -283,19 +305,29 @@ protected void doListFolderElements(boolean stats) throws MailExtractLibExceptio for (int i = 0; i < submittedTasks; i++) { Future future = completionService.poll(60, TimeUnit.SECONDS); if (future == null) { - throw new MailExtractLibException("mailextractlib.javamail: Timeout: no message extracted within 60 seconds, folder extrcation aborted.", null); + throw new MailExtractLibException( + "mailextractlib.javamail: Timeout: no message extracted within 60 seconds, folder extrcation aborted.", + null + ); } try { - future.get(); // Retrieve the task result or propagate any exception + future.get(); // Retrieve the task result or propagate any exception } catch (ExecutionException e) { - MailExtractProgressLogger.doProgressLogWithoutInterruption(getStoreExtractor().getProgressLogger(), - MailExtractProgressLogger.MESSAGE, - "mailextractlib.javamail: Error during a message processing, it's dropped.", e); + MailExtractProgressLogger.doProgressLogWithoutInterruption( + getStoreExtractor().getProgressLogger(), + MailExtractProgressLogger.MESSAGE, + "mailextractlib.javamail: Error during a message processing, it's dropped.", + e + ); } } } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: cannot retrieve messages from folder " - + getFullName() + ", folder listing aborted", e); + throw new MailExtractLibException( + "mailextractlib.javamail: cannot retrieve messages from folder " + + getFullName() + + ", folder listing aborted", + e + ); } finally { pool.shutdownNow(); } @@ -312,7 +344,10 @@ protected void doListFolderElements(boolean stats) throws MailExtractLibExceptio } folder.close(false); } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't get messages from folder " + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't get messages from folder " + getFullName(), + e + ); } } } @@ -337,7 +372,10 @@ protected void doListSubFolders(boolean stats) throws MailExtractLibException, I incFolderSubFoldersCount(); } } catch (MessagingException e) { - throw new MailExtractLibException("mailextractlib.javamail: can't get sub folders from folder " + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.javamail: can't get sub folders from folder " + getFullName(), + e + ); } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java index 05a04703..3f1a792d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/JMStoreMessage.java @@ -37,13 +37,12 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail; +import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; import fr.gouv.vitam.tools.mailextractlib.core.StoreMessage; -import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; import fr.gouv.vitam.tools.mailextractlib.utils.RFC822Headers; - import jakarta.activation.CommandMap; import jakarta.activation.DataHandler; import jakarta.activation.MailcapCommandMap; @@ -70,27 +69,40 @@ * could also be used for POP3 and Gmail, via StoreExtractor (not tested). */ public class JMStoreMessage extends StoreMessage { - /** * Define Mime DataContentHandler to be able to extract signed and encrypted messages (but not decrypting them!) */ static { final MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); - mc.addMailcap("application/pgp-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pgp"); - mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pkcs7_signature"); - mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pkcs7_mime"); - mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.x_pkcs7_signature"); - mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.x_pkcs7_mime"); - mc.addMailcap("multipart/signed;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.multipart_signed"); - - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - CommandMap.setDefaultCommandMap(mc); - - return null; + mc.addMailcap( + "application/pgp-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pgp" + ); + mc.addMailcap( + "application/pkcs7-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pkcs7_signature" + ); + mc.addMailcap( + "application/pkcs7-mime;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.pkcs7_mime" + ); + mc.addMailcap( + "application/x-pkcs7-signature;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.x_pkcs7_signature" + ); + mc.addMailcap( + "application/x-pkcs7-mime;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.x_pkcs7_mime" + ); + mc.addMailcap( + "multipart/signed;; x-java-content-handler=fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers.multipart_signed" + ); + + AccessController.doPrivileged( + new PrivilegedAction() { + public Object run() { + CommandMap.setDefaultCommandMap(mc); + + return null; + } } - }); + ); } /** @@ -99,7 +111,7 @@ public Object run() { protected MimeMessage message; // format to parse dates in Receive header - static private MailDateFormat mailDateFormat = new MailDateFormat(); + private static MailDateFormat mailDateFormat = new MailDateFormat(); /** * Instantiates a new JM mail box message. @@ -125,8 +137,7 @@ public long getMessageSize() throws InterruptedException { // geMessageSize of JavaMail is quite approximative... long result; - if (mimeContent != null) - result = mimeContent.length; + if (mimeContent != null) result = mimeContent.length; else { mimeContent = getNativeMimeContent(); result = mimeContent.length; @@ -137,23 +148,21 @@ public long getMessageSize() throws InterruptedException { // utilities // simple InternetAddress to metadata String - static private String getElementalStringAddress(InternetAddress address) { + private static String getElementalStringAddress(InternetAddress address) { String result = ""; String s; if (address != null) { s = address.getPersonal(); - if (s != null) - result = s + " "; + if (s != null) result = s + " "; s = address.getAddress(); - if (s != null) - result += "<" + s + ">"; + if (s != null) result += "<" + s + ">"; } return result; } // any (simple or group) InternetAddress to metadata String - static private String getStringAddress(InternetAddress address) { + private static String getStringAddress(InternetAddress address) { String result = ""; if (address != null) { @@ -164,8 +173,7 @@ static private String getStringAddress(InternetAddress address) { InternetAddress[] group = address.getGroup(false); result += ":"; for (int k = 0; k < group.length; k++) { - if (k > 0) - result += ","; + if (k > 0) result += ","; result += getElementalStringAddress(group[k]); } } catch (AddressException e) { @@ -221,10 +229,16 @@ protected void analyzeSubject() throws InterruptedException { try { result = message.getSubject(); - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(message.getHeader("Subject", (String) null)); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible( + message.getHeader("Subject", (String) null) + ); } catch (MessagingException e) { - doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, "mailextractlib.javamail: can't get message subject", e); + doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib.javamail: can't get message subject", + e + ); } subject = result; } @@ -262,10 +276,8 @@ protected void analyzeFrom() throws InterruptedException { if (aList.size() > 1) { result = String.join(", ", aList); logMessageWarning("mailextractlib.javamail: multiple From addresses [" + result + "]", null); - } else - result = aList.get(0); - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(result); + } else result = aList.get(0); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible(result); } from = result; } @@ -279,7 +291,7 @@ private List getAddressHeader(String name) throws InterruptedException { } catch (MessagingException me) { logMessageWarning("mailextractlib.javamail: can't access to [" + name + "] address header", me); } - return RFC822Headers.treatAddressHeaderString(name,this,addressHeaderString); + return RFC822Headers.treatAddressHeaderString(name, this, addressHeaderString); } /* @@ -319,10 +331,8 @@ protected void analyzeReturnPath() throws InterruptedException { if (aList.size() > 1) { result = String.join(", ", aList); logMessageWarning("mailextractlib.javamail: multiple Return-Path addresses [" + result + "]", null); - } else - result = aList.get(0); - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(result); + } else result = aList.get(0); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible(result); } returnPath = result; @@ -338,8 +348,7 @@ private Date getReceivedDate() throws MessagingException { String receivedHeader = message.getHeader("Received", ","); if (receivedHeader != null) { int i = receivedHeader.indexOf(';'); - if (i != -1) // supposed to always be - { + if (i != -1) { // supposed to always be receivedHeader = receivedHeader.substring(i + 1); try { result = mailDateFormat.parse(receivedHeader); @@ -379,9 +388,12 @@ protected void analyzeInReplyToId() throws InterruptedException { String[] irtList = message.getHeader("In-Reply-To"); if (irtList != null) { - if (irtList.length > 1) - logMessageWarning( - "mailextractlib.javamail: multiple In-Reply-To identifiers [" + String.join(", ", irtList) + "] keep the first one in header", null); + if (irtList.length > 1) logMessageWarning( + "mailextractlib.javamail: multiple In-Reply-To identifiers [" + + String.join(", ", irtList) + + "] keep the first one in header", + null + ); result = RFC822Headers.getHeaderValue(irtList[0]); } } catch (MessagingException me) { @@ -394,14 +406,12 @@ protected void analyzeInReplyToId() throws InterruptedException { // utility function to get the value part of an header string private static String getHeaderValue(String line) { int i = line.indexOf(':'); - if (i < 0) - return line; + if (i < 0) return line; // skip whitespace after ':' int j; for (j = i + 1; j < line.length(); j++) { char c = line.charAt(j); - if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) - break; + if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) break; } return line.substring(j); } @@ -420,11 +430,9 @@ protected void analyzeReferences() throws InterruptedException { if (refHeader != null) { result = new ArrayList(); String[] refList = getHeaderValue(refHeader).split(" "); - for (String tmp : refList) - try { - result.add(MimeUtility.decodeText(tmp)); - } catch (UnsupportedEncodingException ignored) { - } + for (String tmp : refList) try { + result.add(MimeUtility.decodeText(tmp)); + } catch (UnsupportedEncodingException ignored) {} } } catch (MessagingException me) { logMessageWarning("mailextractlib.javamail: can't access to In-Reply-To header", me); @@ -441,8 +449,7 @@ protected void analyzeReferences() throws InterruptedException { // append to bodyContent after creating it if needed private void appendBodyContent(int type, String s) { if (s != null) { - if (bodyContent[type] == null) - bodyContent[type] = s; + if (bodyContent[type] == null) bodyContent[type] = s; else { bodyContent[type] += "/n" + s; } @@ -467,24 +474,33 @@ private static String getInputStreamContent(InputStream is) { // different versions private void getPartBodyContents(Part p) throws MessagingException, IOException { if (p.isMimeType("text/*")) { - if (p.isMimeType("text/plain") - && ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition()))) { - if (p.getContent() instanceof InputStream) - appendBodyContent(TEXT_BODY, getInputStreamContent((InputStream) p.getContent())); - else if (p.getContent() instanceof String) - appendBodyContent(TEXT_BODY, (String) p.getContent()); - } else if (p.isMimeType("text/html") - && ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition()))) { - if (p.getContent() instanceof InputStream) - appendBodyContent(HTML_BODY, getInputStreamContent((InputStream) p.getContent())); - else if (p.getContent() instanceof String) - appendBodyContent(HTML_BODY, (String) p.getContent()); - } else if (p.isMimeType("text/rtf") - && ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition()))) { - if (p.getContent() instanceof InputStream) - appendBodyContent(RTF_BODY, getInputStreamContent((InputStream) p.getContent())); - else if (p.getContent() instanceof String) - appendBodyContent(RTF_BODY, (String) p.getContent()); + if ( + p.isMimeType("text/plain") && + ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition())) + ) { + if (p.getContent() instanceof InputStream) appendBodyContent( + TEXT_BODY, + getInputStreamContent((InputStream) p.getContent()) + ); + else if (p.getContent() instanceof String) appendBodyContent(TEXT_BODY, (String) p.getContent()); + } else if ( + p.isMimeType("text/html") && + ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition())) + ) { + if (p.getContent() instanceof InputStream) appendBodyContent( + HTML_BODY, + getInputStreamContent((InputStream) p.getContent()) + ); + else if (p.getContent() instanceof String) appendBodyContent(HTML_BODY, (String) p.getContent()); + } else if ( + p.isMimeType("text/rtf") && + ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition())) + ) { + if (p.getContent() instanceof InputStream) appendBodyContent( + RTF_BODY, + getInputStreamContent((InputStream) p.getContent()) + ); + else if (p.getContent() instanceof String) appendBodyContent(RTF_BODY, (String) p.getContent()); } } else if (p.isMimeType("multipart/*")) { Multipart mp = (Multipart) p.getContent(); @@ -504,19 +520,20 @@ protected void analyzeBodies() throws InterruptedException { try { getPartBodyContents(message); } catch (Exception | NoClassDefFoundError e) { - logMessageWarning("mailextractlib.javamail: badly formatted mime message, may not extract all body contents", e); + logMessageWarning( + "mailextractlib.javamail: badly formatted mime message, may not extract all body contents", + e + ); } } // recursively search in MimeParts all attachments private void getAttachments(List lStoreMessageAttachment, BodyPart p) - throws MessagingException, IOException, InterruptedException { - - if ((p.isMimeType("text/plain") || p.isMimeType("text/html") || p.isMimeType("text/rtf")) - && ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition()))) - // test if it's a bodyContent then not an attachment - { - } else if (!p.isMimeType("multipart/*")) { + throws MessagingException, IOException, InterruptedException { + if ( + (p.isMimeType("text/plain") || p.isMimeType("text/html") || p.isMimeType("text/rtf")) && + ((p.getDisposition() == null) || Part.INLINE.equalsIgnoreCase(p.getDisposition())) + ) {} else if (!p.isMimeType("multipart/*")) { // test if it's a bodyContent then not an attachment // any other non multipart is an attachment try { @@ -524,7 +541,6 @@ private void getAttachments(List lStoreMessageAttachment, BodyP } catch (IOException | MessagingException | ParseException e) { logMessageWarning("mailextractlib.javamail: can't extract a badly formatted attachement", e); } - } else if (p.isMimeType("multipart/*")) { Multipart mp = (Multipart) p.getContent(); for (int i = 0; i < mp.getCount(); i++) { @@ -572,7 +588,7 @@ private static String sanitizeFilename(String name) { // add one attachment private void addAttachment(List lStoreMessageAttachment, BodyPart bodyPart) - throws IOException, MessagingException, ParseException, InterruptedException { + throws IOException, MessagingException, ParseException, InterruptedException { String[] headers; ContentDisposition disposition; ContentType contenttype; @@ -593,14 +609,11 @@ private void addAttachment(List lStoreMessageAttachment, BodyPa headers = bodyPart.getHeader("Content-Disposition"); if ((headers != null) && (headers.length > 0)) { disposition = new ContentDisposition(headers[0]); - if (Part.INLINE.equalsIgnoreCase(disposition.getDisposition())) - aType = StoreAttachment.INLINE_ATTACHMENT; + if (Part.INLINE.equalsIgnoreCase(disposition.getDisposition())) aType = StoreAttachment.INLINE_ATTACHMENT; date = disposition.getParameter("creation-date"); - if ((date != null) && (!date.isEmpty())) - aCreationDate = mailDateFormat.parse(date); + if ((date != null) && (!date.isEmpty())) aCreationDate = mailDateFormat.parse(date); date = disposition.getParameter("modification-date"); - if ((date != null) && (!date.isEmpty())) - aModificationDate = mailDateFormat.parse(date); + if ((date != null) && (!date.isEmpty())) aModificationDate = mailDateFormat.parse(date); aName = disposition.getParameter("filename"); } @@ -610,20 +623,15 @@ private void addAttachment(List lStoreMessageAttachment, BodyPa // some kind of mimeType normalization try { contenttype = new ContentType(headers[0]); - if (contenttype.getSubType().equalsIgnoreCase("RFC822")) - aType = StoreAttachment.STORE_ATTACHMENT; + if (contenttype.getSubType().equalsIgnoreCase("RFC822")) aType = StoreAttachment.STORE_ATTACHMENT; aMimeType = contenttype.getBaseType(); - if (aName == null) - aName = contenttype.getParameter("name"); + if (aName == null) aName = contenttype.getParameter("name"); } catch (Exception e) { aMimeType = headers[0]; - if (aMimeType.indexOf(';') != -1) - aMimeType = aMimeType.substring(0, aMimeType.indexOf(';')); + if (aMimeType.indexOf(';') != -1) aMimeType = aMimeType.substring(0, aMimeType.indexOf(';')); int j = aMimeType.lastIndexOf('/'); - if ((j != -1) && (j < aMimeType.length())) - aMimeType = "application/" + aMimeType.substring(j + 1); - else - aMimeType = "application/octet-stream"; + if ((j != -1) && (j < aMimeType.length())) aMimeType = "application/" + aMimeType.substring(j + 1); + else aMimeType = "application/octet-stream"; } } else { // if no mimetype force to general case @@ -632,30 +640,58 @@ private void addAttachment(List lStoreMessageAttachment, BodyPa // get contentId for inline attachment headers = bodyPart.getHeader("Content-ID"); - if ((headers != null) && (headers.length != 0)) - aContentID = headers[0]; + if ((headers != null) && (headers.length != 0)) aContentID = headers[0]; // define a filename if not defined in headers, encode and sanitize it - if (aName == null) - aName = "noname"; - else - try { - aName = MimeUtility.decodeText(aName); - } catch (UnsupportedEncodingException ignored) { - } + if (aName == null) aName = "noname"; + else try { + aName = MimeUtility.decodeText(aName); + } catch (UnsupportedEncodingException ignored) {} aName = sanitizeFilename(aName); - if (aType == StoreAttachment.STORE_ATTACHMENT) - lStoreMessageAttachment.add(new StoreAttachment(this, getPartRawContent(bodyPart), "eml", - MimeUtility.decodeText(aName), aCreationDate, aModificationDate, aMimeType, aContentID, aType)); + if (aType == StoreAttachment.STORE_ATTACHMENT) lStoreMessageAttachment.add( + new StoreAttachment( + this, + getPartRawContent(bodyPart), + "eml", + MimeUtility.decodeText(aName), + aCreationDate, + aModificationDate, + aMimeType, + aContentID, + aType + ) + ); else { - if (aMimeType.toLowerCase().equals("application/ms-tnef") - || aMimeType.toLowerCase().equals("application/vnd.ms-tnef")) - lStoreMessageAttachment.add(new StoreAttachment(this, getPartLFFixedRawContent(bodyPart), "file", - MimeUtility.decodeText(aName), aCreationDate, aModificationDate, aMimeType, aContentID, aType)); - else - lStoreMessageAttachment.add(new StoreAttachment(this, getPartRawContent(bodyPart), "file", - MimeUtility.decodeText(aName), aCreationDate, aModificationDate, aMimeType, aContentID, aType)); + if ( + aMimeType.toLowerCase().equals("application/ms-tnef") || + aMimeType.toLowerCase().equals("application/vnd.ms-tnef") + ) lStoreMessageAttachment.add( + new StoreAttachment( + this, + getPartLFFixedRawContent(bodyPart), + "file", + MimeUtility.decodeText(aName), + aCreationDate, + aModificationDate, + aMimeType, + aContentID, + aType + ) + ); + else lStoreMessageAttachment.add( + new StoreAttachment( + this, + getPartRawContent(bodyPart), + "file", + MimeUtility.decodeText(aName), + aCreationDate, + aModificationDate, + aMimeType, + aContentID, + aType + ) + ); } } @@ -673,12 +709,10 @@ protected void analyzeAttachments() throws InterruptedException { Object contentObject = message.getContent(); if (contentObject instanceof Multipart) { - Multipart multipart = (Multipart) contentObject; for (int i = 0; i < multipart.getCount(); i++) { BodyPart bodyPart = multipart.getBodyPart(i); getAttachments(result, bodyPart); - // filename = bodyPart.getFileName(); // // skip not attachment part // if @@ -691,11 +725,13 @@ protected void analyzeAttachments() throws InterruptedException { } } } catch (Exception e) { - logMessageWarning("mailextractlib.javamail: badly formatted mime message, can't extract all attachments", e); + logMessageWarning( + "mailextractlib.javamail: badly formatted mime message, can't extract all attachments", + e + ); } - if (result.size() == 0) - result = null; + if (result.size() == 0) result = null; attachments = result; } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java index 1138c5eb..5202a3e7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/LFFixingQPDecoderStream.java @@ -49,6 +49,7 @@ * but considering that LF alone in content are CRLF. This is especially to correct encoding in TNEF. */ public class LFFixingQPDecoderStream extends FilterInputStream { + /** * The back buffer. */ @@ -151,8 +152,7 @@ public int read(byte[] buf, int off, int len) throws IOException { public long skip(long n) throws IOException { long skipped; - for (skipped = 0L; n-- > 0L && this.read() >= 0; ++skipped) { - } + for (skipped = 0L; n-- > 0L && this.read() >= 0; ++skipped) {} return skipped; } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java index 6bf0916a..0cfd464c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/OtherMimeCharsetProvider.java @@ -61,16 +61,25 @@ public class OtherMimeCharsetProvider extends CharsetProvider { * For example, the MIME codes for the existing Java charsets are registered with alternate canonical names. *

    */ - static private final List charsets = Arrays.asList( - new RedirectCharset("MACINTOSH", new String[]{}, "x-MacRoman"), - new RedirectCharset("UNKNOWN", new String[]{"DEFAULT","iso-8859-iso-8859-1"}, - "ISO-8859-1"), - new UTF7Charset("UTF-7", new String[]{"UNICODE-1-1-UTF-7", - "CSUNICODE11UTF7", "X-RFC2152", "X-RFC-2152"}, false), - new UTF7Charset("X-UTF-7-OPTIONAL", new String[]{"X-RFC2152-OPTIONAL", - "X-RFC-2152-OPTIONAL"}, true), - new ModifiedUTF7Charset("X-MODIFIED-UTF-7", new String[]{"X-IMAP-MODIFIED-UTF-7", - "X-IMAP4-MODIFIED-UTF7", "X-IMAP4-MODIFIED-UTF-7", "X-RFC3501", "X-RFC-3501"}) + private static final List charsets = Arrays.asList( + new RedirectCharset("MACINTOSH", new String[] {}, "x-MacRoman"), + new RedirectCharset("UNKNOWN", new String[] { "DEFAULT", "iso-8859-iso-8859-1" }, "ISO-8859-1"), + new UTF7Charset( + "UTF-7", + new String[] { "UNICODE-1-1-UTF-7", "CSUNICODE11UTF7", "X-RFC2152", "X-RFC-2152" }, + false + ), + new UTF7Charset("X-UTF-7-OPTIONAL", new String[] { "X-RFC2152-OPTIONAL", "X-RFC-2152-OPTIONAL" }, true), + new ModifiedUTF7Charset( + "X-MODIFIED-UTF-7", + new String[] { + "X-IMAP-MODIFIED-UTF-7", + "X-IMAP4-MODIFIED-UTF7", + "X-IMAP4-MODIFIED-UTF-7", + "X-RFC3501", + "X-RFC-3501", + } + ) ); /** @@ -106,13 +115,11 @@ public Charset charsetForName(String charsetName) { } } // last chance filtering the Charset name - String filteredCharsetName=charsetName.replaceAll("[=_]","-").replaceAll("[^a-zA-Z0-9_-]", ""); - if (!filteredCharsetName.equals(charsetName)){ + String filteredCharsetName = charsetName.replaceAll("[=_]", "-").replaceAll("[^a-zA-Z0-9_-]", ""); + if (!filteredCharsetName.equals(charsetName)) { try { return Charset.forName(filteredCharsetName); - } - catch(Exception ignored) { //NO SONAR - } + } catch (Exception ignored) {} //NO SONAR } return null; } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java index 1d01d1e0..299fdb0c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/RedirectCharset.java @@ -98,4 +98,4 @@ public CharsetDecoder newDecoder() { public CharsetEncoder newEncoder() { return delegate.newEncoder(); } -} \ No newline at end of file +} diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java index 1cd2ede3..855bdcff 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/Base64Util.java @@ -40,81 +40,79 @@ import java.util.Arrays; /** - *

    Represent a base 64 mapping. The 64 characters used in the encoding can be specified, + *

    Represent a base 64 mapping. The 64 characters used in the encoding can be specified, * since modified-UTF-7 uses other characters than UTF-7 (',' instead of '/').

    - * - *

    The exact type of the arguments and result values is adapted to the needs of the - * encoder and decoder, as opposed to following a strict interpretation of base 64.

    - *

    Base 64, as specified in RFC 2045, is an encoding used to encode bytes as characters. - * In (modified-)UTF-7 however, it is used to encode characters as bytes, using some + * + *

    The exact type of the arguments and result values is adapted to the needs of the + * encoder and decoder, as opposed to following a strict interpretation of base 64.

    + *

    Base 64, as specified in RFC 2045, is an encoding used to encode bytes as characters. + * In (modified-)UTF-7 however, it is used to encode characters as bytes, using some * intermediate steps:

    *
      *
    1. Encode all characters as a 16-bit (UTF-16) integer value
    2. - *
    3. Write this as stream of bytes (most-significant first)
    4. + *
    5. Write this as stream of bytes (most-significant first)
    6. *
    7. Encode these bytes using (modified) base 64 encoding
    8. *
    9. Write the thus formed stream of characters as a stream of bytes, using ASCII encoding
    10. *
    - * + * * @author Jaap Beetstra */ class Base64Util { - private static final int ALPHABET_LENGTH = 64; - private final char[] alphabet; - private final int[] inverseAlphabet; - /** - * Initializes the class with the specified encoding/decoding alphabet. - * - * @param alphabet - * @throws IllegalArgumentException if alphabet is not 64 characters long or - * contains characters which are not 7-bit ASCII - */ - Base64Util(final String alphabet) { - this.alphabet = alphabet.toCharArray(); - if (alphabet.length() != ALPHABET_LENGTH) - throw new IllegalArgumentException("alphabet has incorrect length (should be 64, not " - + alphabet.length() + ")"); - inverseAlphabet = new int[128]; - Arrays.fill(inverseAlphabet, -1); - for (int i = 0; i < this.alphabet.length; i++) { - final char ch = this.alphabet[i]; - if (ch >= 128) - throw new IllegalArgumentException("invalid character in alphabet: " + ch); - inverseAlphabet[ch] = i; - } - } + private static final int ALPHABET_LENGTH = 64; + private final char[] alphabet; + private final int[] inverseAlphabet; + + /** + * Initializes the class with the specified encoding/decoding alphabet. + * + * @param alphabet + * @throws IllegalArgumentException if alphabet is not 64 characters long or + * contains characters which are not 7-bit ASCII + */ + Base64Util(final String alphabet) { + this.alphabet = alphabet.toCharArray(); + if (alphabet.length() != ALPHABET_LENGTH) throw new IllegalArgumentException( + "alphabet has incorrect length (should be 64, not " + alphabet.length() + ")" + ); + inverseAlphabet = new int[128]; + Arrays.fill(inverseAlphabet, -1); + for (int i = 0; i < this.alphabet.length; i++) { + final char ch = this.alphabet[i]; + if (ch >= 128) throw new IllegalArgumentException("invalid character in alphabet: " + ch); + inverseAlphabet[ch] = i; + } + } - /** - * Returns the integer value of the six bits represented by the specified character. - * - * @param ch The character, as a ASCII encoded byte - * @return The six bits, as an integer value, or -1 if the byte is not in the alphabet - */ - int getSextet(final byte ch) { - if (ch >= 128) - return -1; - return inverseAlphabet[ch]; - } + /** + * Returns the integer value of the six bits represented by the specified character. + * + * @param ch The character, as a ASCII encoded byte + * @return The six bits, as an integer value, or -1 if the byte is not in the alphabet + */ + int getSextet(final byte ch) { + if (ch >= 128) return -1; + return inverseAlphabet[ch]; + } - /** - * Tells whether the alphabet contains the specified character. - * - * @param ch The character - * @return true if the alphabet contains ch, false otherwise - */ - boolean contains(final char ch) { - if (ch >= 128) - return false; - return inverseAlphabet[ch] >= 0; - } + /** + * Tells whether the alphabet contains the specified character. + * + * @param ch The character + * @return true if the alphabet contains ch, false otherwise + */ + boolean contains(final char ch) { + if (ch >= 128) return false; + return inverseAlphabet[ch] >= 0; + } - /** - * Encodes the six bit group as a character. - * - * @param sextet The six bit group to be encoded - * @return The ASCII value of the character - */ - byte getChar(final int sextet) { - return (byte) alphabet[sextet]; - } + /** + * Encodes the six bit group as a character. + * + * @param sextet The six bit group to be encoded + * @return The ASCII value of the character + */ + byte getChar(final int sextet) { + return (byte) alphabet[sextet]; + } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java index ce5fbf22..886702f9 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/ModifiedUTF7Charset.java @@ -37,32 +37,31 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.charsets.jutf7; - /** *

    The character set specified in RFC 3501 to use for IMAP4rev1 mailbox name encoding.

    - * + * * @see RFC 3501 * @author Jaap Beetstra */ public class ModifiedUTF7Charset extends UTF7StyleCharset { - private static final String MODIFIED_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - + "abcdefghijklmnopqrstuvwxyz" + "0123456789+,"; - public ModifiedUTF7Charset(String name, String[] aliases) { - super(name, aliases, MODIFIED_BASE64_ALPHABET, true); - } + private static final String MODIFIED_BASE64_ALPHABET = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+,"; + + public ModifiedUTF7Charset(String name, String[] aliases) { + super(name, aliases, MODIFIED_BASE64_ALPHABET, true); + } - boolean canEncodeDirectly(char ch) { - if (ch == shift()) - return false; - return ch >= 0x20 && ch <= 0x7E; - } + boolean canEncodeDirectly(char ch) { + if (ch == shift()) return false; + return ch >= 0x20 && ch <= 0x7E; + } - byte shift() { - return '&'; - } + byte shift() { + return '&'; + } - byte unshift() { - return '-'; - } + byte unshift() { + return '-'; + } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java index 57b47595..84c76018 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7Charset.java @@ -40,44 +40,43 @@ /** *

    The character set specified in RFC 2152. Two variants are supported using the encodeOptional * constructor flag

    - * + * * @see RFC 2152 * @author Jaap Beetstra */ public class UTF7Charset extends UTF7StyleCharset { - private static final String BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; - private static final String SET_D = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?"; - private static final String SET_O = "!\"#$%&*;<=>@[]^_`{|}"; - private static final String RULE_3 = " \t\r\n"; - final String directlyEncoded; - public UTF7Charset(String name, String[] aliases, boolean includeOptional) { - super(name, aliases, BASE64_ALPHABET, false); - if (includeOptional) - this.directlyEncoded = SET_D + SET_O + RULE_3; - else - this.directlyEncoded = SET_D + RULE_3; - } + private static final String BASE64_ALPHABET = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + private static final String SET_D = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?"; + private static final String SET_O = "!\"#$%&*;<=>@[]^_`{|}"; + private static final String RULE_3 = " \t\r\n"; + final String directlyEncoded; + + public UTF7Charset(String name, String[] aliases, boolean includeOptional) { + super(name, aliases, BASE64_ALPHABET, false); + if (includeOptional) this.directlyEncoded = SET_D + SET_O + RULE_3; + else this.directlyEncoded = SET_D + RULE_3; + } - /* (non-Javadoc) - * @see com.beetstra.jutf7.UTF7StyleCharset#canEncodeDirectly(char) - */ - boolean canEncodeDirectly(char ch) { - return directlyEncoded.indexOf(ch) >= 0; - } + /* (non-Javadoc) + * @see com.beetstra.jutf7.UTF7StyleCharset#canEncodeDirectly(char) + */ + boolean canEncodeDirectly(char ch) { + return directlyEncoded.indexOf(ch) >= 0; + } - /* (non-Javadoc) - * @see com.beetstra.jutf7.UTF7StyleCharset#shift() - */ - byte shift() { - return '+'; - } + /* (non-Javadoc) + * @see com.beetstra.jutf7.UTF7StyleCharset#shift() + */ + byte shift() { + return '+'; + } - /* (non-Javadoc) - * @see com.beetstra.jutf7.UTF7StyleCharset#unshift() - */ - byte unshift() { - return '-'; - } + /* (non-Javadoc) + * @see com.beetstra.jutf7.UTF7StyleCharset#unshift() + */ + byte unshift() { + return '-'; + } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java index e4cdba43..2a664cc0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharset.java @@ -45,74 +45,75 @@ /** *

    Abstract base class for UTF-7 style encoding and decoding.

    - * + * * @author Jaap Beetstra */ abstract class UTF7StyleCharset extends Charset { - private static final List CONTAINED = Arrays.asList(new String[] { "US-ASCII", "ISO-8859-1", - "UTF-8", "UTF-16", "UTF-16LE", "UTF-16BE" }); - final boolean strict; - Base64Util base64; - /** - *

    Besides the name and aliases, two additional parameters are required. First the - * base 64 alphabet used; in modified UTF-7 a slightly different alphabet is used. - * Additionally, it should be specified if encoders and decoders should be strict - * about the interpretation of malformed encoded sequences. This is used since - * modified UTF-7 specifically disallows some constructs which are allowed (or not - * specifically disallowed) in UTF-7 (RFC 2152).

    - * - * @param canonicalName The name as defined in java.nio.charset.Charset - * @param aliases The aliases as defined in java.nio.charset.Charset - * @param alphabet The base 64 alphabet used - * @param strict True if strict handling of sequences is requested - */ - protected UTF7StyleCharset(String canonicalName, String[] aliases, String alphabet, - boolean strict) { - super(canonicalName, aliases); - this.base64 = new Base64Util(alphabet); - this.strict = strict; - } + private static final List CONTAINED = Arrays.asList( + new String[] { "US-ASCII", "ISO-8859-1", "UTF-8", "UTF-16", "UTF-16LE", "UTF-16BE" } + ); + final boolean strict; + Base64Util base64; + + /** + *

    Besides the name and aliases, two additional parameters are required. First the + * base 64 alphabet used; in modified UTF-7 a slightly different alphabet is used. + * Additionally, it should be specified if encoders and decoders should be strict + * about the interpretation of malformed encoded sequences. This is used since + * modified UTF-7 specifically disallows some constructs which are allowed (or not + * specifically disallowed) in UTF-7 (RFC 2152).

    + * + * @param canonicalName The name as defined in java.nio.charset.Charset + * @param aliases The aliases as defined in java.nio.charset.Charset + * @param alphabet The base 64 alphabet used + * @param strict True if strict handling of sequences is requested + */ + protected UTF7StyleCharset(String canonicalName, String[] aliases, String alphabet, boolean strict) { + super(canonicalName, aliases); + this.base64 = new Base64Util(alphabet); + this.strict = strict; + } - /* (non-Javadoc) - * @see java.nio.charset.Charset#contains(java.nio.charset.Charset) - */ - public boolean contains(final Charset cs) { - return CONTAINED.contains(cs.name()); - } + /* (non-Javadoc) + * @see java.nio.charset.Charset#contains(java.nio.charset.Charset) + */ + public boolean contains(final Charset cs) { + return CONTAINED.contains(cs.name()); + } - /* (non-Javadoc) - * @see java.nio.charset.Charset#newDecoder() - */ - public CharsetDecoder newDecoder() { - return new UTF7StyleCharsetDecoder(this, base64, strict); - } + /* (non-Javadoc) + * @see java.nio.charset.Charset#newDecoder() + */ + public CharsetDecoder newDecoder() { + return new UTF7StyleCharsetDecoder(this, base64, strict); + } - /* (non-Javadoc) - * @see java.nio.charset.Charset#newEncoder() - */ - public CharsetEncoder newEncoder() { - return new UTF7StyleCharsetEncoder(this, base64, strict); - } + /* (non-Javadoc) + * @see java.nio.charset.Charset#newEncoder() + */ + public CharsetEncoder newEncoder() { + return new UTF7StyleCharsetEncoder(this, base64, strict); + } - /** - * Tells if a character can be encoded using simple (US-ASCII) encoding or - * requires base 64 encoding. - * - * @param ch The character - * @return True if the character can be encoded directly, false otherwise - */ - abstract boolean canEncodeDirectly(char ch); + /** + * Tells if a character can be encoded using simple (US-ASCII) encoding or + * requires base 64 encoding. + * + * @param ch The character + * @return True if the character can be encoded directly, false otherwise + */ + abstract boolean canEncodeDirectly(char ch); - /** - * Returns character used to switch to base 64 encoding. - * @return The shift character - */ - abstract byte shift(); + /** + * Returns character used to switch to base 64 encoding. + * @return The shift character + */ + abstract byte shift(); - /** - * Returns character used to switch from base 64 encoding to simple encoding. - * @return The unshift character - */ - abstract byte unshift(); + /** + * Returns character used to switch from base 64 encoding to simple encoding. + * @return The unshift character + */ + abstract byte unshift(); } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java index 067ddb7d..742c2d75 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetDecoder.java @@ -43,154 +43,145 @@ import java.nio.charset.CoderResult; /** - *

    The CharsetDecoder used to decode both variants of the UTF-7 charset and the + *

    The CharsetDecoder used to decode both variants of the UTF-7 charset and the * modified-UTF-7 charset.

    - * + * * @author Jaap Beetstra */ class UTF7StyleCharsetDecoder extends CharsetDecoder { - private final Base64Util base64; - private final byte shift; - private final byte unshift; - private final boolean strict; - private boolean base64mode; - private int bitsRead; - private int tempChar; - private boolean justShifted; - private boolean justUnshifted; - UTF7StyleCharsetDecoder(UTF7StyleCharset cs, Base64Util base64, boolean strict) { - super(cs, 0.6f, 1.0f); - this.base64 = base64; - this.strict = strict; - this.shift = cs.shift(); - this.unshift = cs.unshift(); - } + private final Base64Util base64; + private final byte shift; + private final byte unshift; + private final boolean strict; + private boolean base64mode; + private int bitsRead; + private int tempChar; + private boolean justShifted; + private boolean justUnshifted; + + UTF7StyleCharsetDecoder(UTF7StyleCharset cs, Base64Util base64, boolean strict) { + super(cs, 0.6f, 1.0f); + this.base64 = base64; + this.strict = strict; + this.shift = cs.shift(); + this.unshift = cs.unshift(); + } - /* (non-Javadoc) - * @see java.nio.charset.CharsetDecoder#decodeLoop(java.nio.ByteBuffer, java.nio.CharBuffer) - */ - protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { - while (in.hasRemaining()) { - byte b = in.get(); - if (base64mode) { - if (b == unshift) { - if (base64bitsWaiting()) - return malformed(in); - if (justShifted) { - if (!out.hasRemaining()) - return overflow(in); - out.put((char) shift); - } else - justUnshifted = true; - setUnshifted(); - } else { - if (!out.hasRemaining()) - return overflow(in); - CoderResult result = handleBase64(in, out, b); - if (result != null) - return result; - } - justShifted = false; - } else { - if (b == shift) { - base64mode = true; - if (justUnshifted && strict) - return malformed(in); - justShifted = true; - continue; - } - if (!out.hasRemaining()) - return overflow(in); - out.put((char) b); - justUnshifted = false; - } - } - return CoderResult.UNDERFLOW; - } + /* (non-Javadoc) + * @see java.nio.charset.CharsetDecoder#decodeLoop(java.nio.ByteBuffer, java.nio.CharBuffer) + */ + protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { + while (in.hasRemaining()) { + byte b = in.get(); + if (base64mode) { + if (b == unshift) { + if (base64bitsWaiting()) return malformed(in); + if (justShifted) { + if (!out.hasRemaining()) return overflow(in); + out.put((char) shift); + } else justUnshifted = true; + setUnshifted(); + } else { + if (!out.hasRemaining()) return overflow(in); + CoderResult result = handleBase64(in, out, b); + if (result != null) return result; + } + justShifted = false; + } else { + if (b == shift) { + base64mode = true; + if (justUnshifted && strict) return malformed(in); + justShifted = true; + continue; + } + if (!out.hasRemaining()) return overflow(in); + out.put((char) b); + justUnshifted = false; + } + } + return CoderResult.UNDERFLOW; + } - private CoderResult overflow(ByteBuffer in) { - in.position(in.position() - 1); - return CoderResult.OVERFLOW; - } + private CoderResult overflow(ByteBuffer in) { + in.position(in.position() - 1); + return CoderResult.OVERFLOW; + } - /** - *

    Decodes a byte in base 64 mode. Will directly write a character to the output - * buffer if completed.

    - * - * @param in The input buffer - * @param out The output buffer - * @param lastRead Last byte read from the input buffer - * @return CoderResult.malformed if a non-base 64 character was encountered in strict - * mode, null otherwise - */ - private CoderResult handleBase64(ByteBuffer in, CharBuffer out, byte lastRead) { - CoderResult result = null; - int sextet = base64.getSextet(lastRead); - if (sextet >= 0) { - bitsRead += 6; - if (bitsRead < 16) { - tempChar += sextet << (16 - bitsRead); - } else { - bitsRead -= 16; - tempChar += sextet >> (bitsRead); - out.put((char) tempChar); - tempChar = (sextet << (16 - bitsRead)) & 0xFFFF; - } - } else { - if (strict) - return malformed(in); - out.put((char) lastRead); - if (base64bitsWaiting()) - result = malformed(in); - setUnshifted(); - } - return result; - } + /** + *

    Decodes a byte in base 64 mode. Will directly write a character to the output + * buffer if completed.

    + * + * @param in The input buffer + * @param out The output buffer + * @param lastRead Last byte read from the input buffer + * @return CoderResult.malformed if a non-base 64 character was encountered in strict + * mode, null otherwise + */ + private CoderResult handleBase64(ByteBuffer in, CharBuffer out, byte lastRead) { + CoderResult result = null; + int sextet = base64.getSextet(lastRead); + if (sextet >= 0) { + bitsRead += 6; + if (bitsRead < 16) { + tempChar += sextet << (16 - bitsRead); + } else { + bitsRead -= 16; + tempChar += sextet >> (bitsRead); + out.put((char) tempChar); + tempChar = (sextet << (16 - bitsRead)) & 0xFFFF; + } + } else { + if (strict) return malformed(in); + out.put((char) lastRead); + if (base64bitsWaiting()) result = malformed(in); + setUnshifted(); + } + return result; + } - /* (non-Javadoc) - * @see java.nio.charset.CharsetDecoder#implFlush(java.nio.CharBuffer) - */ - protected CoderResult implFlush(CharBuffer out) { - if ((base64mode && strict) || base64bitsWaiting()) - return CoderResult.malformedForLength(1); - return CoderResult.UNDERFLOW; - } + /* (non-Javadoc) + * @see java.nio.charset.CharsetDecoder#implFlush(java.nio.CharBuffer) + */ + protected CoderResult implFlush(CharBuffer out) { + if ((base64mode && strict) || base64bitsWaiting()) return CoderResult.malformedForLength(1); + return CoderResult.UNDERFLOW; + } - /* (non-Javadoc) - * @see java.nio.charset.CharsetDecoder#implReset() - */ - protected void implReset() { - setUnshifted(); - justUnshifted = false; - } + /* (non-Javadoc) + * @see java.nio.charset.CharsetDecoder#implReset() + */ + protected void implReset() { + setUnshifted(); + justUnshifted = false; + } - /** - *

    Resets the input buffer position to just before the last byte read, and returns - * a result indicating to skip the last byte.

    - * - * @param in The input buffer - * @return CoderResult.malformedForLength(1); - */ - private CoderResult malformed(ByteBuffer in) { - in.position(in.position() - 1); - return CoderResult.malformedForLength(1); - } + /** + *

    Resets the input buffer position to just before the last byte read, and returns + * a result indicating to skip the last byte.

    + * + * @param in The input buffer + * @return CoderResult.malformedForLength(1); + */ + private CoderResult malformed(ByteBuffer in) { + in.position(in.position() - 1); + return CoderResult.malformedForLength(1); + } - /** - * @return True if there are base64 encoded characters waiting to be written - */ - private boolean base64bitsWaiting() { - return tempChar != 0 || bitsRead >= 6; - } + /** + * @return True if there are base64 encoded characters waiting to be written + */ + private boolean base64bitsWaiting() { + return tempChar != 0 || bitsRead >= 6; + } - /** - *

    Updates internal state to reflect the decoder is no longer in base 64 - * mode

    - */ - private void setUnshifted() { - base64mode = false; - bitsRead = 0; - tempChar = 0; - } -} \ No newline at end of file + /** + *

    Updates internal state to reflect the decoder is no longer in base 64 + * mode

    + */ + private void setUnshifted() { + base64mode = false; + bitsRead = 0; + tempChar = 0; + } +} diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java index 9c642d8a..35eb1d20 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/charsets/jutf7/UTF7StyleCharsetEncoder.java @@ -43,166 +43,160 @@ import java.nio.charset.CoderResult; /** - *

    The CharsetEncoder used to encode both variants of the UTF-7 charset and the + *

    The CharsetEncoder used to encode both variants of the UTF-7 charset and the * modified-UTF-7 charset.

    - * - *

    Please note this class does not behave strictly according to the specification in - * Sun Java VMs before 1.6. This is done to get around a bug in the implementation + * + *

    Please note this class does not behave strictly according to the specification in + * Sun Java VMs before 1.6. This is done to get around a bug in the implementation * of {@link CharsetEncoder#encode(CharBuffer)}. Unfortunately, that method * cannot be overridden.

    - * + * * @see JDK bug 6221056 - * + * * @author Jaap Beetstra */ class UTF7StyleCharsetEncoder extends CharsetEncoder { - private static final float AVG_BYTES_PER_CHAR = 1.5f; - private static final float MAX_BYTES_PER_CHAR = 5.0f; - private final UTF7StyleCharset cs; - private final Base64Util base64; - private final byte shift; - private final byte unshift; - private final boolean strict; - private boolean base64mode; - private int bitsToOutput; - private int sextet; - static boolean useUglyHackToForceCallToFlushInJava5; - static { - String version = System.getProperty("java.specification.version"); - String vendor = System.getProperty("java.vm.vendor"); - useUglyHackToForceCallToFlushInJava5 = "1.4".equals(version) || "1.5".equals(version); - useUglyHackToForceCallToFlushInJava5 &= "Sun Microsystems Inc.".equals(vendor); - } - UTF7StyleCharsetEncoder(UTF7StyleCharset cs, Base64Util base64, boolean strict) { - super(cs, AVG_BYTES_PER_CHAR, MAX_BYTES_PER_CHAR); - this.cs = cs; - this.base64 = base64; - this.strict = strict; - this.shift = cs.shift(); - this.unshift = cs.unshift(); - } + private static final float AVG_BYTES_PER_CHAR = 1.5f; + private static final float MAX_BYTES_PER_CHAR = 5.0f; + private final UTF7StyleCharset cs; + private final Base64Util base64; + private final byte shift; + private final byte unshift; + private final boolean strict; + private boolean base64mode; + private int bitsToOutput; + private int sextet; + static boolean useUglyHackToForceCallToFlushInJava5; + + static { + String version = System.getProperty("java.specification.version"); + String vendor = System.getProperty("java.vm.vendor"); + useUglyHackToForceCallToFlushInJava5 = "1.4".equals(version) || "1.5".equals(version); + useUglyHackToForceCallToFlushInJava5 &= "Sun Microsystems Inc.".equals(vendor); + } + + UTF7StyleCharsetEncoder(UTF7StyleCharset cs, Base64Util base64, boolean strict) { + super(cs, AVG_BYTES_PER_CHAR, MAX_BYTES_PER_CHAR); + this.cs = cs; + this.base64 = base64; + this.strict = strict; + this.shift = cs.shift(); + this.unshift = cs.unshift(); + } - /* (non-Javadoc) - * @see java.nio.charset.CharsetEncoder#implReset() - */ - protected void implReset() { - base64mode = false; - sextet = 0; - bitsToOutput = 0; - } + /* (non-Javadoc) + * @see java.nio.charset.CharsetEncoder#implReset() + */ + protected void implReset() { + base64mode = false; + sextet = 0; + bitsToOutput = 0; + } - /** - * {@inheritDoc} - * - *

    Note that this method might return CoderResult.OVERFLOW (as is - * required by the specification) if insufficient space is available in the output - * buffer. However, calling it again on JDKs before Java 6 triggers a bug in - * {@link CharsetEncoder#flush(ByteBuffer)} causing it to throw an - * IllegalStateException (the buggy method is final, thus cannot be - * overridden).

    - * - * @see JDK bug 6227608 - * @param out The output byte buffer - * @return A coder-result object describing the reason for termination - */ - protected CoderResult implFlush(ByteBuffer out) { - if (base64mode) { - if (out.remaining() < 2) - return CoderResult.OVERFLOW; - if (bitsToOutput != 0) - out.put(base64.getChar(sextet)); - out.put(unshift); - } - return CoderResult.UNDERFLOW; - } + /** + * {@inheritDoc} + * + *

    Note that this method might return CoderResult.OVERFLOW (as is + * required by the specification) if insufficient space is available in the output + * buffer. However, calling it again on JDKs before Java 6 triggers a bug in + * {@link CharsetEncoder#flush(ByteBuffer)} causing it to throw an + * IllegalStateException (the buggy method is final, thus cannot be + * overridden).

    + * + * @see JDK bug 6227608 + * @param out The output byte buffer + * @return A coder-result object describing the reason for termination + */ + protected CoderResult implFlush(ByteBuffer out) { + if (base64mode) { + if (out.remaining() < 2) return CoderResult.OVERFLOW; + if (bitsToOutput != 0) out.put(base64.getChar(sextet)); + out.put(unshift); + } + return CoderResult.UNDERFLOW; + } - /** - * {@inheritDoc} - * - *

    Note that this method might return CoderResult.OVERFLOW, even - * though there is sufficient space available in the output buffer. This is done - * to force the broken implementation of - * {@link CharsetEncoder#encode(CharBuffer)} to call flush - * (the buggy method is final, thus cannot be overridden).

    - *

    However, String.getBytes() fails if CoderResult.OVERFLOW is returned, since - * this assumes it always allocates sufficient bytes (maxBytesPerChar * nr_of_chars). - * Thus, as an extra check, the size of the input buffer is compared against the size - * of the output buffer. - * A static variable is used to indicate if a broken java version is used.

    - *

    It is not possible to directly write the last few bytes, since more bytes - * might be waiting to be encoded then those available in the input buffer.

    - * - * @see JDK bug 6221056 - * @param in The input character buffer - * @param out The output byte buffer - * @return A coder-result object describing the reason for termination - */ - protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) { - while (in.hasRemaining()) { - if (out.remaining() < 4) - return CoderResult.OVERFLOW; - char ch = in.get(); - if (cs.canEncodeDirectly(ch)) { - unshift(out, ch); - out.put((byte) ch); - } else if (!base64mode && ch == shift) { - out.put(shift); - out.put(unshift); - } else - encodeBase64(ch, out); - } - /* + /** + * {@inheritDoc} + * + *

    Note that this method might return CoderResult.OVERFLOW, even + * though there is sufficient space available in the output buffer. This is done + * to force the broken implementation of + * {@link CharsetEncoder#encode(CharBuffer)} to call flush + * (the buggy method is final, thus cannot be overridden).

    + *

    However, String.getBytes() fails if CoderResult.OVERFLOW is returned, since + * this assumes it always allocates sufficient bytes (maxBytesPerChar * nr_of_chars). + * Thus, as an extra check, the size of the input buffer is compared against the size + * of the output buffer. + * A static variable is used to indicate if a broken java version is used.

    + *

    It is not possible to directly write the last few bytes, since more bytes + * might be waiting to be encoded then those available in the input buffer.

    + * + * @see JDK bug 6221056 + * @param in The input character buffer + * @param out The output byte buffer + * @return A coder-result object describing the reason for termination + */ + protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) { + while (in.hasRemaining()) { + if (out.remaining() < 4) return CoderResult.OVERFLOW; + char ch = in.get(); + if (cs.canEncodeDirectly(ch)) { + unshift(out, ch); + out.put((byte) ch); + } else if (!base64mode && ch == shift) { + out.put(shift); + out.put(unshift); + } else encodeBase64(ch, out); + } + /* These lines are required to trick JDK 1.5 and earlier into flushing when using Charset.encode(String), Charset.encode(CharBuffer) or CharsetEncoder.encode(CharBuffer) Without them, the last few bytes may be missing. */ - if (base64mode && useUglyHackToForceCallToFlushInJava5 - && out.limit() != MAX_BYTES_PER_CHAR * in.limit()) - return CoderResult.OVERFLOW; - /* */ - return CoderResult.UNDERFLOW; - } + if ( + base64mode && useUglyHackToForceCallToFlushInJava5 && out.limit() != MAX_BYTES_PER_CHAR * in.limit() + ) return CoderResult.OVERFLOW; + /*
    */ + return CoderResult.UNDERFLOW; + } - /** - *

    Writes the bytes necessary to leave base 64 mode. This might include an unshift - * character.

    - * - * @param out - * @param ch - */ - private void unshift(ByteBuffer out, char ch) { - if (!base64mode) - return; - if (bitsToOutput != 0) - out.put(base64.getChar(sextet)); - if (base64.contains(ch) || ch == unshift || strict) - out.put(unshift); - base64mode = false; - sextet = 0; - bitsToOutput = 0; - } + /** + *

    Writes the bytes necessary to leave base 64 mode. This might include an unshift + * character.

    + * + * @param out + * @param ch + */ + private void unshift(ByteBuffer out, char ch) { + if (!base64mode) return; + if (bitsToOutput != 0) out.put(base64.getChar(sextet)); + if (base64.contains(ch) || ch == unshift || strict) out.put(unshift); + base64mode = false; + sextet = 0; + bitsToOutput = 0; + } - /** - *

    Writes the bytes necessary to encode a character in base 64 mode. All bytes - * which are fully determined will be written. The fields bitsToOutput and - * sextet are used to remember the bytes not yet fully determined.

    - * - * @param out - * @param ch - */ - private void encodeBase64(char ch, ByteBuffer out) { - if (!base64mode) - out.put(shift); - base64mode = true; - bitsToOutput += 16; - while (bitsToOutput >= 6) { - bitsToOutput -= 6; - sextet += (ch >> bitsToOutput); - sextet &= 0x3F; - out.put(base64.getChar(sextet)); - sextet = 0; - } - sextet = (ch << (6 - bitsToOutput)) & 0x3F; - } -} \ No newline at end of file + /** + *

    Writes the bytes necessary to encode a character in base 64 mode. All bytes + * which are fully determined will be written. The fields bitsToOutput and + * sextet are used to remember the bytes not yet fully determined.

    + * + * @param out + * @param ch + */ + private void encodeBase64(char ch, ByteBuffer out) { + if (!base64mode) out.put(shift); + base64mode = true; + bitsToOutput += 16; + while (bitsToOutput >= 6) { + bitsToOutput -= 6; + sextet += (ch >> bitsToOutput); + sextet &= 0x3F; + out.put(base64.getChar(sextet)); + sextet = 0; + } + sextet = (ch << (6 - bitsToOutput)) & 0x3F; + } +} diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java index 934d1d29..0b113b22 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlFolder.java @@ -38,10 +38,10 @@ package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; - import jakarta.mail.*; import jakarta.mail.util.SharedByteArrayInputStream; import jakarta.mail.util.SharedFileInputStream; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -183,10 +183,8 @@ public boolean hasNewMessages() { */ @Override public Folder getFolder(String name) throws MessagingException { - if ((name == null) || (name.isEmpty())) - return new EmlFolder(emlstore); - else - throw new MethodNotSupportedException("eml: no folder supported"); + if ((name == null) || (name.isEmpty())) return new EmlFolder(emlstore); + else throw new MethodNotSupportedException("eml: no folder supported"); } /* @@ -230,8 +228,7 @@ public boolean isOpen() { */ @Override public void open(int mode) throws MessagingException { - if (opened) - throw new IllegalStateException("eml: simulated folder is already open"); + if (opened) throw new IllegalStateException("eml: simulated folder is already open"); this.mode = mode; switch (mode) { @@ -248,7 +245,6 @@ public void open(int mode) throws MessagingException { } else { // create input stream from file try { - emlInputStream = new SharedFileInputStream(new File(emlstore.getContainer())); } catch (IOException e) { throw new MessagingException("eml: open failure, can't read: " + emlstore.getContainer()); @@ -264,8 +260,7 @@ public void open(int mode) throws MessagingException { */ @Override public void close(boolean expunge) throws MessagingException { - if (!opened) - throw new IllegalStateException("eml: simulated folder is not open"); + if (!opened) throw new IllegalStateException("eml: simulated folder is not open"); opened = false; try { emlInputStream.close(); @@ -291,8 +286,7 @@ public int getMessageCount() throws MessagingException { */ @Override public Message getMessage(int msgno) throws MessagingException { - if (msgno != 1) - throw new IndexOutOfBoundsException("Eml: only message 1, no message number " + msgno); + if (msgno != 1) throw new IndexOutOfBoundsException("Eml: only message 1, no message number " + msgno); Message m; m = new JMMimeMessage(this, emlInputStream, msgno); @@ -325,7 +319,14 @@ public Message[] expunge() throws MessagingException { public URLName getURLName() { URLName storeURL = getStore().getURLName(); - return new URLName(storeURL.getProtocol(), storeURL.getHost(), storeURL.getPort(), emlstore.getContainer(), - storeURL.getUsername(), null /* no password */); + return new URLName( + storeURL.getProtocol(), + storeURL.getHost(), + storeURL.getPort(), + emlstore.getContainer(), + storeURL.getUsername(), + null + /* no password */ + ); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java index 03b2827e..c42c9106 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/EmlStore.java @@ -38,8 +38,8 @@ package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMEmbeddedStore; - import jakarta.mail.*; + import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -103,12 +103,11 @@ protected boolean protocolConnect(String host, int port, String user, String pas // verify only if not embedded if (objectContent == null) { // verify params significance in ThunderMBox context - if (!host.equals("localhost")) - throw new MessagingException("eml: only support localhost"); - if (!((passwd == null) || (passwd.isEmpty()))) - throw new MessagingException("eml: does not allow passwords"); - if (port != -1) - throw new MessagingException("eml: does not allow port selection"); + if (!host.equals("localhost")) throw new MessagingException("eml: only support localhost"); + if (!((passwd == null) || (passwd.isEmpty()))) throw new MessagingException( + "eml: does not allow passwords" + ); + if (port != -1) throw new MessagingException("eml: does not allow port selection"); // verify declared file for eml availability try { @@ -141,10 +140,8 @@ public Folder getDefaultFolder() throws MessagingException { */ @Override public Folder getFolder(String name) throws MessagingException { - if ((name == null) || (name.isEmpty())) - return new EmlFolder(this); - else - throw new MessagingException("eml: only one root simulated folder, no " + name + " folder"); + if ((name == null) || (name.isEmpty())) return new EmlFolder(this); + else throw new MessagingException("eml: only one root simulated folder, no " + name + " folder"); } /* @@ -155,19 +152,15 @@ public Folder getFolder(String name) throws MessagingException { @Override public Folder getFolder(URLName url) throws MessagingException { // verify that the root directory in store is respected - if ((url.getFile() == null) || (url.getFile().isEmpty())) - return new EmlFolder(this); - else - throw new MessagingException("eml: only one root simulated folder, no " + url.getFile() + " folder"); + if ((url.getFile() == null) || (url.getFile().isEmpty())) return new EmlFolder(this); + else throw new MessagingException("eml: only one root simulated folder, no " + url.getFile() + " folder"); } public void setObjectContent(Object objectContent) { - if (objectContent instanceof byte[]) - this.objectContent = (byte[]) objectContent; + if (objectContent instanceof byte[]) this.objectContent = (byte[]) objectContent; } public Object getObjectContent() { return objectContent; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java index bafbb1a5..553376f3 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/eml/package-info.java @@ -41,4 +41,4 @@ *

    Warning:Only for reading and without file locking or * new messages management. */ -package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.javamail.eml; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java index bbe9eefc..a9993af0 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/HandlerUtil.java @@ -37,79 +37,61 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import jakarta.mail.MessagingException; -import jakarta.mail.internet.MimeBodyPart; import jakarta.activation.ActivationDataFlavor; import jakarta.activation.DataContentHandler; import jakarta.activation.DataSource; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeBodyPart; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; -class HandlerUtil -{ +class HandlerUtil { - static void writeFromInputStream(InputStream obj, OutputStream os) - throws IOException - { - int b; + static void writeFromInputStream(InputStream obj, OutputStream os) throws IOException { + int b; InputStream in = obj; - if (!(in instanceof BufferedInputStream)) - { + if (!(in instanceof BufferedInputStream)) { in = new BufferedInputStream(in); } - while ((b = in.read()) >= 0) - { + while ((b = in.read()) >= 0) { os.write(b); } in.close(); } - static void writeFromBarrInputStream(Object obj, OutputStream os) - throws IOException - { - if(obj instanceof byte[]) - { - os.write((byte[])obj); - } - else if (obj instanceof InputStream) - { - writeFromInputStream((InputStream)obj, os); - } - else - { + static void writeFromBarrInputStream(Object obj, OutputStream os) throws IOException { + if (obj instanceof byte[]) { + os.write((byte[]) obj); + } else if (obj instanceof InputStream) { + writeFromInputStream((InputStream) obj, os); + } else { throw new IOException("unknown object in writeTo " + obj); } } - static void writeFromMimeBodyPart(MimeBodyPart obj, OutputStream os) - throws IOException - { - try - { + static void writeFromMimeBodyPart(MimeBodyPart obj, OutputStream os) throws IOException { + try { obj.writeTo(os); - } - catch (MessagingException ex) - { + } catch (MessagingException ex) { throw new IOException(ex.getMessage()); } } - static Object getTransferData(DataContentHandler handler, ActivationDataFlavor adf, ActivationDataFlavor df, DataSource ds) - throws IOException - { - if (adf.equals(df)) - { + static Object getTransferData( + DataContentHandler handler, + ActivationDataFlavor adf, + ActivationDataFlavor df, + DataSource ds + ) throws IOException { + if (adf.equals(df)) { return handler.getContent(ds); - } - else - { + } else { return null; } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java index 7ba61d85..6e84ae05 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/SignatureContentHandler.java @@ -37,60 +37,40 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; -import java.io.IOException; -import java.io.OutputStream; - import jakarta.activation.ActivationDataFlavor; import jakarta.activation.DataContentHandler; import jakarta.activation.DataSource; import jakarta.mail.internet.MimeBodyPart; -public class SignatureContentHandler - implements DataContentHandler -{ +import java.io.IOException; +import java.io.OutputStream; + +public class SignatureContentHandler implements DataContentHandler { + private final ActivationDataFlavor _adf; - private final ActivationDataFlavor[] _dfs; - - SignatureContentHandler( - ActivationDataFlavor adf, - ActivationDataFlavor[] dfs) - { + private final ActivationDataFlavor[] _dfs; + + SignatureContentHandler(ActivationDataFlavor adf, ActivationDataFlavor[] dfs) { _adf = adf; _dfs = dfs; } - public Object getContent( - DataSource ds) - throws IOException - { + public Object getContent(DataSource ds) throws IOException { return ds.getInputStream(); } - - public Object getTransferData( - ActivationDataFlavor df, - DataSource ds) - throws IOException - { + + public Object getTransferData(ActivationDataFlavor df, DataSource ds) throws IOException { return HandlerUtil.getTransferData(this, _adf, df, ds); } - - public ActivationDataFlavor[] getTransferDataFlavors() - { + + public ActivationDataFlavor[] getTransferDataFlavors() { return _dfs; } - - public void writeTo( - Object obj, - String mimeType, - OutputStream os) - throws IOException - { - if (obj instanceof MimeBodyPart) - { - HandlerUtil.writeFromMimeBodyPart((MimeBodyPart)obj, os); - } - else - { + + public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException { + if (obj instanceof MimeBodyPart) { + HandlerUtil.writeFromMimeBodyPart((MimeBodyPart) obj, os); + } else { HandlerUtil.writeFromBarrInputStream(obj, os); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java index 80348bde..9465250d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/multipart_signed.java @@ -37,13 +37,6 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.Enumeration; - import jakarta.activation.ActivationDataFlavor; import jakarta.activation.DataContentHandler; import jakarta.activation.DataSource; @@ -53,53 +46,46 @@ import jakarta.mail.internet.MimeBodyPart; import jakarta.mail.internet.MimeMultipart; -public class multipart_signed - implements DataContentHandler -{ - private static final ActivationDataFlavor ADF = new ActivationDataFlavor(MimeMultipart.class, "multipart/signed", "Multipart Signed"); - private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[]{ADF}; - - public Object getContent(DataSource ds) - throws IOException - { - try - { +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Enumeration; + +public class multipart_signed implements DataContentHandler { + + private static final ActivationDataFlavor ADF = new ActivationDataFlavor( + MimeMultipart.class, + "multipart/signed", + "Multipart Signed" + ); + private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; + + public Object getContent(DataSource ds) throws IOException { + try { return new MimeMultipart(ds); - } - catch (MessagingException ex) - { + } catch (MessagingException ex) { return null; } } - public Object getTransferData(ActivationDataFlavor df, DataSource ds) - throws IOException - { + public Object getTransferData(ActivationDataFlavor df, DataSource ds) throws IOException { return HandlerUtil.getTransferData(this, ADF, df, ds); } - public ActivationDataFlavor[] getTransferDataFlavors() - { + public ActivationDataFlavor[] getTransferDataFlavors() { return DFS; } - public void writeTo(Object obj, String _mimeType, OutputStream os) - throws IOException - { - - if (obj instanceof MimeMultipart) - { - try - { + public void writeTo(Object obj, String _mimeType, OutputStream os) throws IOException { + if (obj instanceof MimeMultipart) { + try { outputBodyPart(os, obj); - } - catch (MessagingException ex) - { + } catch (MessagingException ex) { throw new IOException(ex.getMessage()); } - } - else - { + } else { HandlerUtil.writeFromBarrInputStream(obj, os); } } @@ -107,51 +93,42 @@ public void writeTo(Object obj, String _mimeType, OutputStream os) /* * Output the mulitpart as a collection of leaves to make sure preamble text is not included. */ - private void outputBodyPart( - OutputStream out, - Object bodyPart) - throws MessagingException, IOException - { - if (bodyPart instanceof Multipart) - { - Multipart mp = (Multipart)bodyPart; + private void outputBodyPart(OutputStream out, Object bodyPart) throws MessagingException, IOException { + if (bodyPart instanceof Multipart) { + Multipart mp = (Multipart) bodyPart; ContentType contentType = new ContentType(mp.getContentType()); String boundary = "--" + contentType.getParameter("boundary"); LineOutputStream lOut = new LineOutputStream(out); - for (int i = 0; i < mp.getCount(); i++) - { + for (int i = 0; i < mp.getCount(); i++) { lOut.writeln(boundary); outputBodyPart(out, mp.getBodyPart(i)); - lOut.writeln(); // CRLF terminator + lOut.writeln(); // CRLF terminator } lOut.writeln(boundary + "--"); return; } - MimeBodyPart mimePart = (MimeBodyPart)bodyPart; + MimeBodyPart mimePart = (MimeBodyPart) bodyPart; - if (mimePart.isMimeType("multipart/*")) - { + if (mimePart.isMimeType("multipart/*")) { Object content = mimePart.getContent(); - if (content instanceof Multipart) - { - Multipart mp = (Multipart)content; + if (content instanceof Multipart) { + Multipart mp = (Multipart) content; ContentType contentType = new ContentType(mp.getContentType()); String boundary = "--" + contentType.getParameter("boundary"); LineOutputStream lOut = new LineOutputStream(out); Enumeration headers = mimePart.getAllHeaderLines(); - while (headers.hasMoreElements()) - { - lOut.writeln((String)headers.nextElement()); + while (headers.hasMoreElements()) { + lOut.writeln((String) headers.nextElement()); } - lOut.writeln(); // CRLF separator + lOut.writeln(); // CRLF separator outputPreamble(lOut, mimePart, boundary); @@ -168,25 +145,19 @@ private void outputBodyPart( * if we find internal preamble we include it by default. */ static void outputPreamble(LineOutputStream lOut, MimeBodyPart part, String boundary) - throws MessagingException, IOException - { + throws MessagingException, IOException { InputStream in; - try - { + try { in = part.getRawInputStream(); - } - catch (MessagingException e) - { - return; // no underlying content, rely on default generation + } catch (MessagingException e) { + return; // no underlying content, rely on default generation } String line; - while ((line = readLine(in)) != null) - { - if (line.equals(boundary)) - { + while ((line = readLine(in)) != null) { + if (line.equals(boundary)) { break; } @@ -195,8 +166,7 @@ static void outputPreamble(LineOutputStream lOut, MimeBodyPart part, String boun in.close(); - if (line == null) - { + if (line == null) { throw new MessagingException("no boundary found"); } } @@ -204,68 +174,50 @@ static void outputPreamble(LineOutputStream lOut, MimeBodyPart part, String boun /* * read a line of input stripping of the tailing \r\n */ - private static String readLine(InputStream in) - throws IOException - { + private static String readLine(InputStream in) throws IOException { StringBuffer b = new StringBuffer(); int ch; - while ((ch = in.read()) >= 0 && ch != '\n') - { - if (ch != '\r') - { - b.append((char)ch); + while ((ch = in.read()) >= 0 && ch != '\n') { + if (ch != '\r') { + b.append((char) ch); } } - if (ch < 0) - { + if (ch < 0) { return null; } return b.toString(); } - private static class LineOutputStream - extends FilterOutputStream - { + private static class LineOutputStream extends FilterOutputStream { + private static byte newline[]; - public LineOutputStream(OutputStream outputstream) - { + public LineOutputStream(OutputStream outputstream) { super(outputstream); } - public void writeln(String s) - throws MessagingException - { - try - { + public void writeln(String s) throws MessagingException { + try { byte abyte0[] = s.getBytes(StandardCharsets.UTF_8); super.out.write(abyte0); super.out.write(newline); - } - catch (Exception exception) - { + } catch (Exception exception) { throw new MessagingException("IOException", exception); } } - public void writeln() - throws MessagingException - { - try - { + public void writeln() throws MessagingException { + try { super.out.write(newline); - } - catch (Exception exception) - { + } catch (Exception exception) { throw new MessagingException("IOException", exception); } } - static - { + static { newline = new byte[2]; newline[0] = 13; newline[1] = 10; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java index ed69ac5b..f64f294e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pgp.java @@ -40,14 +40,16 @@ import jakarta.activation.ActivationDataFlavor; import jakarta.mail.internet.MimeBodyPart; -public class pgp - extends SignatureContentHandler -{ - private static final ActivationDataFlavor ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/pgp-signature", "PGP Signature"); - private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; +public class pgp extends SignatureContentHandler { - public pgp() - { + private static final ActivationDataFlavor ADF = new ActivationDataFlavor( + MimeBodyPart.class, + "application/pgp-signature", + "PGP Signature" + ); + private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; + + public pgp() { super(ADF, DFS); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java index 06b18030..394f33e8 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_mime.java @@ -40,14 +40,16 @@ import jakarta.activation.ActivationDataFlavor; import jakarta.mail.internet.MimeBodyPart; -public class pkcs7_mime - extends SignatureContentHandler -{ - private static final ActivationDataFlavor ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/pkcs7-mime", "Encrypted Data"); - private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; - - public pkcs7_mime() - { +public class pkcs7_mime extends SignatureContentHandler { + + private static final ActivationDataFlavor ADF = new ActivationDataFlavor( + MimeBodyPart.class, + "application/pkcs7-mime", + "Encrypted Data" + ); + private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; + + public pkcs7_mime() { super(ADF, DFS); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java index 85e495a7..fd9bbb11 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/pkcs7_signature.java @@ -40,14 +40,16 @@ import jakarta.activation.ActivationDataFlavor; import jakarta.mail.internet.MimeBodyPart; -public class pkcs7_signature - extends SignatureContentHandler -{ - private static final ActivationDataFlavor ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/pkcs7-signature", "Signature"); - private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; - - public pkcs7_signature() - { +public class pkcs7_signature extends SignatureContentHandler { + + private static final ActivationDataFlavor ADF = new ActivationDataFlavor( + MimeBodyPart.class, + "application/pkcs7-signature", + "Signature" + ); + private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; + + public pkcs7_signature() { super(ADF, DFS); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java index 83a79784..40eb904c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_mime.java @@ -40,14 +40,16 @@ import jakarta.activation.ActivationDataFlavor; import jakarta.mail.internet.MimeBodyPart; -public class x_pkcs7_mime - extends SignatureContentHandler -{ - private static final ActivationDataFlavor ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/x-pkcs7-mime", "Encrypted Data"); - private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; - - public x_pkcs7_mime() - { +public class x_pkcs7_mime extends SignatureContentHandler { + + private static final ActivationDataFlavor ADF = new ActivationDataFlavor( + MimeBodyPart.class, + "application/x-pkcs7-mime", + "Encrypted Data" + ); + private static final ActivationDataFlavor[] DFS = new ActivationDataFlavor[] { ADF }; + + public x_pkcs7_mime() { super(ADF, DFS); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java index c21cea4b..bc43ef04 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/handlers/x_pkcs7_signature.java @@ -37,68 +37,51 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.javamail.handlers; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - import jakarta.activation.ActivationDataFlavor; import jakarta.activation.DataContentHandler; import jakarta.activation.DataSource; import jakarta.mail.internet.MimeBodyPart; -public class x_pkcs7_signature - implements DataContentHandler -{ - - /* - * +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class x_pkcs7_signature implements DataContentHandler { + + /* + * * VARIABLES - * - */ - + * + */ + private static final ActivationDataFlavor ADF; - private static final ActivationDataFlavor[] ADFs; - - static - { - ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/x-pkcs7-signature", "Signature"); + private static final ActivationDataFlavor[] ADFs; + + static { + ADF = new ActivationDataFlavor(MimeBodyPart.class, "application/x-pkcs7-signature", "Signature"); ADFs = new ActivationDataFlavor[] { ADF }; } - - public Object getContent(DataSource _ds) - throws IOException - { + + public Object getContent(DataSource _ds) throws IOException { return _ds.getInputStream(); } - - public Object getTransferData(ActivationDataFlavor _df, DataSource _ds) - throws IOException - { + + public Object getTransferData(ActivationDataFlavor _df, DataSource _ds) throws IOException { return HandlerUtil.getTransferData(this, ADF, _df, _ds); } - - public ActivationDataFlavor[] getTransferDataFlavors() - { + + public ActivationDataFlavor[] getTransferDataFlavors() { return ADFs; } - - public void writeTo(Object _obj, String _mimeType, OutputStream _os) - throws IOException - { - if (_obj instanceof MimeBodyPart) - { - HandlerUtil.writeFromMimeBodyPart((MimeBodyPart)_obj, _os); - } - else if (_obj instanceof byte[]) - { - _os.write((byte[])_obj); - } - else if (_obj instanceof InputStream) - { - HandlerUtil.writeFromInputStream((InputStream)_obj, _os); - } - else - { + + public void writeTo(Object _obj, String _mimeType, OutputStream _os) throws IOException { + if (_obj instanceof MimeBodyPart) { + HandlerUtil.writeFromMimeBodyPart((MimeBodyPart) _obj, _os); + } else if (_obj instanceof byte[]) { + _os.write((byte[]) _obj); + } else if (_obj instanceof InputStream) { + HandlerUtil.writeFromInputStream((InputStream) _obj, _os); + } else { throw new IOException("unknown object in writeTo " + _obj); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java index c63775d5..9591a1b2 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxFolder.java @@ -39,8 +39,8 @@ import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; - import jakarta.mail.*; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -64,6 +64,7 @@ public class MboxFolder extends Folder { private int total; // total number of messages in mailbox private class MessageFork { + long beg, end; MessageFork(long beg, long end) { @@ -208,10 +209,8 @@ public boolean hasNewMessages() { */ @Override public Folder getFolder(String name) throws MessagingException { - if ((name == null) || (name.isEmpty())) - return new MboxFolder(mboxstore); - else - throw new MethodNotSupportedException("mbox: no folder supported"); + if ((name == null) || (name.isEmpty())) return new MboxFolder(mboxstore); + else throw new MethodNotSupportedException("mbox: no folder supported"); } /* @@ -255,8 +254,7 @@ public boolean isOpen() { */ @Override public void open(int mode) throws MessagingException { - if (opened) - throw new IllegalStateException("mbox: file " + mboxstore.getContainer() + " is already open"); + if (opened) throw new IllegalStateException("mbox: file " + mboxstore.getContainer() + " is already open"); this.mode = mode; switch (mode) { @@ -271,10 +269,11 @@ public void open(int mode) throws MessagingException { MessageFork mf; try { - if (mboxstore.getObjectContent() != null) - mboxfilereader = new MboxReader(logger, (byte[]) mboxstore.getObjectContent()); - else - mboxfilereader = new MboxReader(logger, new File(mboxstore.getContainer())); + if (mboxstore.getObjectContent() != null) mboxfilereader = new MboxReader( + logger, + (byte[]) mboxstore.getObjectContent() + ); + else mboxfilereader = new MboxReader(logger, new File(mboxstore.getContainer())); opened = true; // now really opened long beg, end; @@ -300,8 +299,7 @@ public void open(int mode) throws MessagingException { */ @Override public void close(boolean expunge) throws MessagingException { - if (!opened) - throw new IllegalStateException("mbox: file " + mboxstore.getContainer() + " is not open"); + if (!opened) throw new IllegalStateException("mbox: file " + mboxstore.getContainer() + " is not open"); messages = null; opened = false; try { @@ -318,8 +316,7 @@ public void close(boolean expunge) throws MessagingException { */ @Override public int getMessageCount() throws MessagingException { - if (!opened) - return -1; + if (!opened) return -1; return total; } @@ -331,16 +328,17 @@ public int getMessageCount() throws MessagingException { */ @Override public Message getMessage(int msgno) throws MessagingException { - if (msgno < 1) // message-numbers start at 1 - throw new IndexOutOfBoundsException("message number " + msgno + " < 1"); - else if (msgno > total) // Still out of range ? Throw up ... - throw new IndexOutOfBoundsException("message number " + msgno + " > " + total); + if (msgno < 1) throw new IndexOutOfBoundsException("message number " + msgno + " < 1"); // message-numbers start at 1 + else if (msgno > total) throw new IndexOutOfBoundsException("message number " + msgno + " > " + total); // Still out of range ? Throw up ... Message m; // each get regenerate a message with no strong link so that it can be // GC // optimal for the extraction usage with only one get by message - m = new JMMimeMessage(this, mboxfilereader.newStream(messages.get(msgno - 1).beg, messages.get(msgno - 1).end), - msgno); + m = new JMMimeMessage( + this, + mboxfilereader.newStream(messages.get(msgno - 1).beg, messages.get(msgno - 1).end), + msgno + ); return m; } @@ -370,7 +368,14 @@ public Message[] expunge() throws MessagingException { public URLName getURLName() { URLName storeURL = getStore().getURLName(); - return new URLName(storeURL.getProtocol(), storeURL.getHost(), storeURL.getPort(), mboxstore.getContainer(), - storeURL.getUsername(), null /* no password */); + return new URLName( + storeURL.getProtocol(), + storeURL.getHost(), + storeURL.getPort(), + mboxstore.getContainer(), + storeURL.getUsername(), + null + /* no password */ + ); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java index d916f8e8..3623bb72 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxReader.java @@ -38,10 +38,10 @@ package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; - import jakarta.mail.internet.SharedInputStream; import jakarta.mail.util.SharedByteArrayInputStream; import jakarta.mail.util.SharedFileInputStream; + import java.io.*; /** @@ -115,10 +115,8 @@ public MailExtractProgressLogger getProgressLogger() { * @throws IOException Unable to close the file. */ public void close() throws IOException { - if (raf != null) - raf.close(); - if (sifs instanceof InputStream) - ((InputStream) sifs).close(); + if (raf != null) raf.close(); + if (sifs instanceof InputStream) ((InputStream) sifs).close(); } /** @@ -141,8 +139,7 @@ private final int read() throws IOException { // if File if (curPos >= len) { bufferPos = raf.getFilePointer(); - if ((len = raf.read(buffer)) == -1) - return -1; + if ((len = raf.read(buffer)) == -1) return -1; curPos = 0; } } else { @@ -150,8 +147,7 @@ private final int read() throws IOException { // TODO get rid of buffer when byte[] if (curPos >= len) { bufferPos = sifs.getPosition(); - if ((len = ((ByteArrayInputStream) sifs).read(buffer)) == -1) - return -1; + if ((len = ((ByteArrayInputStream) sifs).read(buffer)) == -1) return -1; curPos = 0; } } @@ -171,10 +167,8 @@ private final int readFirstBytesLine(byte[] buffer) throws IOException { lineNum++; while (true) { b = read(); - if (b == -1) - return -1; - if (b == '\n') - return i; + if (b == -1) return -1; + if (b == '\n') return i; if (i < 64) { buffer[i++] = (byte) b; } @@ -186,8 +180,7 @@ private String constructLine(byte[] buffer, int len) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < len; i++) { final char c = (char) (buffer[i]); - if (c >= 32) - stringBuilder.append(c); + if (c >= 32) stringBuilder.append(c); } return stringBuilder.toString(); } @@ -206,12 +199,10 @@ private String constructLine(byte[] buffer, int len) { //After the "From " line is the message itself in RFC 5322 format. The final line is a completely blank line with no spaces or tabs. // WARNING: due to tested mbox files diversity the only kept filter is the beginning "From " pattern! private boolean isCompliantMBoxDelimiterLine(byte[] buffer, int len) { - if ((buffer[0] == 'F') && (buffer[1] == 'r') && (buffer[2] == 'o') && (buffer[3] == 'm') - && (buffer[4] == ' ')) - return true; - else - return false; - + if ( + (buffer[0] == 'F') && (buffer[1] == 'r') && (buffer[2] == 'o') && (buffer[3] == 'm') && (buffer[4] == ' ') + ) return true; + else return false; } /** @@ -232,10 +223,10 @@ public long getNextFromLineBeg() throws IOException { fromLineEnd = -1; return -1; } - if (isCompliantMBoxDelimiterLine(buffer, len)) { - fromLineEnd = getPointer(); - return beg; - } + if (isCompliantMBoxDelimiterLine(buffer, len)) { + fromLineEnd = getPointer(); + return beg; + } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java index eef93461..137ded21 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/MboxStore.java @@ -38,8 +38,8 @@ package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMEmbeddedStore; - import jakarta.mail.*; + import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -103,12 +103,11 @@ protected boolean protocolConnect(String host, int port, String user, String pas // verify only if not embedded if (objectContent == null) { // verify params significance in ThunderMBox context - if (!host.equals("localhost")) - throw new MessagingException("mbox: only support localhost"); - if (!((passwd == null) || (passwd.isEmpty()))) - throw new MessagingException("mbox: does not allow passwords"); - if (port != -1) - throw new MessagingException("mbox: does not allow port selection"); + if (!host.equals("localhost")) throw new MessagingException("mbox: only support localhost"); + if (!((passwd == null) || (passwd.isEmpty()))) throw new MessagingException( + "mbox: does not allow passwords" + ); + if (port != -1) throw new MessagingException("mbox: does not allow port selection"); // verify declared file for mbox availability try { @@ -141,10 +140,8 @@ public Folder getDefaultFolder() throws MessagingException { */ @Override public Folder getFolder(String name) throws MessagingException { - if ((name == null) || (name.isEmpty())) - return new MboxFolder(this); - else - throw new MessagingException("mbox: only one root simulated folder, no " + name + " folder"); + if ((name == null) || (name.isEmpty())) return new MboxFolder(this); + else throw new MessagingException("mbox: only one root simulated folder, no " + name + " folder"); } /* @@ -154,16 +151,13 @@ public Folder getFolder(String name) throws MessagingException { */ @Override public Folder getFolder(URLName url) throws MessagingException { - if ((url.getFile() == null) || (url.getFile().isEmpty())) - return new MboxFolder(this); - else - throw new MessagingException("mbox: only one root simulated folder, no " + url.getFile() + " folder"); + if ((url.getFile() == null) || (url.getFile().isEmpty())) return new MboxFolder(this); + else throw new MessagingException("mbox: only one root simulated folder, no " + url.getFile() + " folder"); } @Override public void setObjectContent(Object objectContent) { - if (objectContent instanceof byte[]) - this.objectContent = (byte[]) objectContent; + if (objectContent instanceof byte[]) this.objectContent = (byte[]) objectContent; } @Override diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java index c8ad903c..9c6c2192 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/mbox/package-info.java @@ -41,4 +41,4 @@ *

    Warning:Only for reading and without file locking or new * messages management. */ -package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java index 88849b40..a008f012 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/package-info.java @@ -41,4 +41,4 @@ * For now, IMAP and Thunderbird mbox, eml structure through MailExtract application, * could also be used for POP3 and Gmail, via StoreExtractor (not tested). */ -package fr.gouv.vitam.tools.mailextractlib.store.javamail; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.javamail; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java index 6ad3881f..3edbda1d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdFolder.java @@ -40,9 +40,9 @@ import fr.gouv.vitam.tools.mailextractlib.store.javamail.JMMimeMessage; import fr.gouv.vitam.tools.mailextractlib.store.javamail.mbox.MboxReader; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; - import jakarta.mail.*; import org.eclipse.angus.mail.imap.protocol.BASE64MailboxDecoder; + import java.io.*; import java.util.ArrayList; import java.util.HashMap; @@ -72,6 +72,7 @@ public class ThunderbirdFolder extends Folder { private MailExtractProgressLogger logger; private class MessageFork { + long beg, end; MessageFork(long beg, long end) { @@ -109,8 +110,8 @@ public ThunderbirdFolder(ThunderbirdStore store, String folderFullName) throws M this.mstore = store; this.folderFullName = folderFullName; - holdsFlags = (isBoxHoldingMessages(folderFullName) ? HOLDS_MESSAGES : 0) - | (isBoxHoldingFolders(folderFullName) ? HOLDS_FOLDERS : 0); + holdsFlags = (isBoxHoldingMessages(folderFullName) ? HOLDS_MESSAGES : 0) | + (isBoxHoldingFolders(folderFullName) ? HOLDS_FOLDERS : 0); if (folderFullName != null) { folderFile = new File(getFilePathFromFolderFullName(folderFullName)); } @@ -145,13 +146,21 @@ private String getFilePathFromFolderFullName(String folderFullName) { } private String getSubFolderDirectoryPathFromFolderFullName(String folderPath) { - return mstore.getContainer() + File.separator + folderPath.replace(File.separator, ".sbd" + File.separator) - + ".sbd"; + return ( + mstore.getContainer() + + File.separator + + folderPath.replace(File.separator, ".sbd" + File.separator) + + ".sbd" + ); } private String getIndexFilePathFromFolderFullName(String folderPath) { - return mstore.getContainer() + File.separator + folderPath.replace(File.separator, ".sbd" + File.separator) - + ".msf"; + return ( + mstore.getContainer() + + File.separator + + folderPath.replace(File.separator, ".sbd" + File.separator) + + ".msf" + ); } private String getFolderNameFromFileName(String fileName) { @@ -159,17 +168,13 @@ private String getFolderNameFromFileName(String fileName) { } private String getFolderNameFromIndexFileName(String fileName) { - if (fileName.endsWith(".msf")) - return fileName.substring(0, fileName.length() - 4); - else - return fileName; + if (fileName.endsWith(".msf")) return fileName.substring(0, fileName.length() - 4); + else return fileName; } private String getFolderNameFromSubFolderDirectoryName(String fileName) { - if (fileName.endsWith(".sbd")) - return fileName.substring(0, fileName.length() - 4); - else - return fileName; + if (fileName.endsWith(".sbd")) return fileName.substring(0, fileName.length() - 4); + else return fileName; } private String getFolderFullNameFromPath(String filePath) { @@ -190,11 +195,8 @@ private String getSubFolderFullName(String folderName) { */ @Override public String getName() { - if (folderFullName == null) - return ""; - else - // XXXX - return BASE64MailboxDecoder.decode(folderFile.getName()); + if (folderFullName == null) return ""; + else return BASE64MailboxDecoder.decode(folderFile.getName()); // XXXX } /* @@ -204,21 +206,21 @@ public String getName() { */ @Override public String getFullName() { - if (folderFullName == null) - return ""; - else - return BASE64MailboxDecoder.decode(folderFullName); + if (folderFullName == null) return ""; + else return BASE64MailboxDecoder.decode(folderFullName); } // test functions used to determine if a folder hold messages and/or // subfolders private boolean isSubFoldersDirectory(File test) { - if (!test.exists() || !test.isDirectory()) - return false; + if (!test.exists() || !test.isDirectory()) return false; if (!test.getName().endsWith(".sbd")) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.WARNING, - "ThunderMBox: Maybe sub folders directory " + test.getPath() + " without .sbd suffix is ignored", - null); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.WARNING, + "ThunderMBox: Maybe sub folders directory " + test.getPath() + " without .sbd suffix is ignored", + null + ); return false; } return true; @@ -226,8 +228,7 @@ private boolean isSubFoldersDirectory(File test) { private boolean isThundebirdMboxFile(File test) { // first is it a file - if (!test.exists() || !test.isFile()) - return false; + if (!test.exists() || !test.isFile()) return false; // then verify that the file content is beginning with "From " BufferedReader reader = null; try { @@ -235,62 +236,55 @@ private boolean isThundebirdMboxFile(File test) { String firstline = ""; while (firstline.isEmpty()) { firstline = reader.readLine(); - if (firstline == null) - break; + if (firstline == null) break; firstline = firstline.trim(); } - if (firstline == null || !firstline.startsWith("From")) - return false; + if (firstline == null || !firstline.startsWith("From")) return false; } catch (IOException e) { - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.WARNING, - "ThunderMBox: Maybe mailbox file " + test.getPath() + " can't be opened and is ignored", - e); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.WARNING, + "ThunderMBox: Maybe mailbox file " + test.getPath() + " can't be opened and is ignored", + e + ); } finally { try { - if (reader != null) - reader.close(); + if (reader != null) reader.close(); } catch (IOException e) { // forget it } } // then verify that an index file exists "fileName".msf test = new File(test.getPath() + ".msf"); - if (!test.exists()) - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.WARNING, - "ThunderMBox: Maybe mailbox file " + test.getPath() + " don't have an index file but is analyzed", - null); + if (!test.exists()) doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.WARNING, + "ThunderMBox: Maybe mailbox file " + test.getPath() + " don't have an index file but is analyzed", + null + ); return true; } private boolean isThunderIndexFile(File test) { - if (!test.exists() || !test.isFile()) - return false; + if (!test.exists() || !test.isFile()) return false; return (test.getName().endsWith(".msf")); } private boolean isBoxHoldingMessages(String folderFullName) { - if (folderFullName == null) - return false; - else - return isThundebirdMboxFile(new File(getFilePathFromFolderFullName(folderFullName))); + if (folderFullName == null) return false; + else return isThundebirdMboxFile(new File(getFilePathFromFolderFullName(folderFullName))); } private boolean isBoxHoldingFolders(String folderFullName) { - if (folderFullName == null) - return true; - else - return isSubFoldersDirectory(new File(getSubFolderDirectoryPathFromFolderFullName(folderFullName))); + if (folderFullName == null) return true; + else return isSubFoldersDirectory(new File(getSubFolderDirectoryPathFromFolderFullName(folderFullName))); } private boolean isBox(String folderPath) { - if (isThundebirdMboxFile(new File(getFilePathFromFolderFullName(folderPath)))) - return true; - else if (isSubFoldersDirectory(new File(getSubFolderDirectoryPathFromFolderFullName(folderPath)))) - return true; - else if (isThunderIndexFile(new File(getIndexFilePathFromFolderFullName(folderPath)))) - return true; - else - return false; + if (isThundebirdMboxFile(new File(getFilePathFromFolderFullName(folderPath)))) return true; + else if (isSubFoldersDirectory(new File(getSubFolderDirectoryPathFromFolderFullName(folderPath)))) return true; + else if (isThunderIndexFile(new File(getIndexFilePathFromFolderFullName(folderPath)))) return true; + else return false; } /* @@ -335,8 +329,7 @@ public Folder[] list() throws MessagingException { File folder = new File(sbdPath); File[] listOfFiles = folder.listFiles(); - if (listOfFiles == null) - return result; + if (listOfFiles == null) return result; HashMap boxes = new HashMap(); for (int i = 0; i < listOfFiles.length; i++) { @@ -357,11 +350,18 @@ public Folder[] list() throws MessagingException { continue; } // fourth case empty file - if (listOfFiles[i].isFile() && listOfFiles[i].length() == 0) - continue; + if (listOfFiles[i].isFile() && listOfFiles[i].length() == 0) continue; // then garbage and warning - doProgressLogWithoutInterruption(logger, MailExtractProgressLogger.WARNING, "ThunderMBox: Wrong mailbox file " + listOfFiles[i].getName() + " in " - + (folderFullName == null ? "root folder" : "folder " + folderFullName) + " is ignored", null); + doProgressLogWithoutInterruption( + logger, + MailExtractProgressLogger.WARNING, + "ThunderMBox: Wrong mailbox file " + + listOfFiles[i].getName() + + " in " + + (folderFullName == null ? "root folder" : "folder " + folderFullName) + + " is ignored", + null + ); } ArrayList folders = new ArrayList(); @@ -381,10 +381,8 @@ public Folder[] list() throws MessagingException { */ @Override public Folder getParent() throws MessagingException { - if (folderFullName == null) - return this; - else - return getFolder(getFolderFullNameFromPath(folderFile.getParent())); + if (folderFullName == null) return this; + else return getFolder(getFolderFullNameFromPath(folderFile.getParent())); } /* @@ -394,8 +392,7 @@ public Folder getParent() throws MessagingException { */ @Override public boolean exists() { - if (folderFullName == null) - return true; + if (folderFullName == null) return true; else { return isBox(folderFullName); } @@ -483,21 +480,24 @@ public boolean isOpen() { */ @Override public void open(int mode) throws MessagingException { - if (opened) - throw new IllegalStateException("ThunderMBox: Folder " + folderFullName + " is already open"); - - if ((getType() & HOLDS_MESSAGES) == 0) - throw new MessagingException("Folder " + folderFullName + " cannot contain messages"); - if (!folderFile.exists()) - throw new FolderNotFoundException(this, "ThunderMBox: Folder " + folderFullName + " doesn't exist"); + if (opened) throw new IllegalStateException("ThunderMBox: Folder " + folderFullName + " is already open"); + + if ((getType() & HOLDS_MESSAGES) == 0) throw new MessagingException( + "Folder " + folderFullName + " cannot contain messages" + ); + if (!folderFile.exists()) throw new FolderNotFoundException( + this, + "ThunderMBox: Folder " + folderFullName + " doesn't exist" + ); this.mode = mode; switch (mode) { case READ_WRITE: throw new MethodNotSupportedException("ThunderMBox: no writing supported"); case READ_ONLY: default: - if (!folderFile.canRead()) - throw new MessagingException("ThunderMBox: open Failure, can't read: " + folderFile.getPath()); + if (!folderFile.canRead()) throw new MessagingException( + "ThunderMBox: open Failure, can't read: " + folderFile.getPath() + ); break; } @@ -531,8 +531,7 @@ public void open(int mode) throws MessagingException { */ @Override public void close(boolean expunge) throws MessagingException { - if (!opened) - throw new IllegalStateException("ThunderMBox: Folder " + folderFullName + " is not Open"); + if (!opened) throw new IllegalStateException("ThunderMBox: Folder " + folderFullName + " is not Open"); messages = null; opened = false; try { @@ -549,8 +548,7 @@ public void close(boolean expunge) throws MessagingException { */ @Override public int getMessageCount() throws MessagingException { - if (!opened) - return -1; + if (!opened) return -1; return total; } @@ -562,16 +560,17 @@ public int getMessageCount() throws MessagingException { */ @Override public Message getMessage(int msgno) throws MessagingException { - if (msgno < 1) // message-numbers start at 1 - throw new IndexOutOfBoundsException("message number " + msgno + " < 1"); - else if (msgno > total) // Still out of range ? Throw up ... - throw new IndexOutOfBoundsException("message number " + msgno + " > " + total); + if (msgno < 1) throw new IndexOutOfBoundsException("message number " + msgno + " < 1"); // message-numbers start at 1 + else if (msgno > total) throw new IndexOutOfBoundsException("message number " + msgno + " > " + total); // Still out of range ? Throw up ... Message m; // each get regenerate a message with no strong link so that it can be // GC // optimal for the extraction usage with only one get by message - m = new JMMimeMessage(this, mboxfilereader.newStream(messages.get(msgno - 1).beg, messages.get(msgno - 1).end), - msgno); + m = new JMMimeMessage( + this, + mboxfilereader.newStream(messages.get(msgno - 1).beg, messages.get(msgno - 1).end), + msgno + ); return m; } @@ -601,7 +600,14 @@ public Message[] expunge() throws MessagingException { public URLName getURLName() { URLName storeURL = getStore().getURLName(); - return new URLName(storeURL.getProtocol(), storeURL.getHost(), storeURL.getPort(), - mstore.getContainer() + File.separator + getFullName(), storeURL.getUsername(), null /* no password */); + return new URLName( + storeURL.getProtocol(), + storeURL.getHost(), + storeURL.getPort(), + mstore.getContainer() + File.separator + getFullName(), + storeURL.getUsername(), + null + /* no password */ + ); } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java index 207e854d..7435acd4 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/ThunderbirdStore.java @@ -38,6 +38,7 @@ package fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird; import jakarta.mail.*; + import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -79,7 +80,6 @@ public String getContainer() { */ public ThunderbirdStore(Session session, URLName url) { super(session, url); - try { container = URLDecoder.decode(url.getFile(), "UTF-8"); } catch (UnsupportedEncodingException e) { @@ -110,10 +110,10 @@ public ThunderbirdStore(Session session, URLName url) { @Override protected boolean protocolConnect(String host, int port, String user, String passwd) throws MessagingException { // verify params significance in ThunderMBox context - if (!((passwd == null) || (passwd.isEmpty()))) - throw new MessagingException("ThunderMBox: does not allow passwords"); - if (port != -1) - throw new MessagingException("ThunderMBox: does not allow port selection"); + if (!((passwd == null) || (passwd.isEmpty()))) throw new MessagingException( + "ThunderMBox: does not allow passwords" + ); + if (port != -1) throw new MessagingException("ThunderMBox: does not allow port selection"); // verify declared directory for thunderbird mbox hierarchy availability File test = new File(container); @@ -140,10 +140,8 @@ public Folder getDefaultFolder() throws MessagingException { */ @Override public Folder getFolder(String name) throws MessagingException { - if (name.equals(container)) - name = null; - else if (name.startsWith(container)) - name = name.substring(container.length() + 1); + if (name.equals(container)) name = null; + else if (name.startsWith(container)) name = name.substring(container.length() + 1); return new ThunderbirdFolder(this, name); } @@ -161,9 +159,9 @@ public Folder getFolder(URLName url) throws MessagingException { } catch (UnsupportedEncodingException e) { // not possible } - if (!filename.startsWith(container)) - throw new MessagingException("ThunderMBox: folder must be in directory declared for the store"); + if (!filename.startsWith(container)) throw new MessagingException( + "ThunderMBox: folder must be in directory declared for the store" + ); return getFolder(url.getFile().substring(container.length())); } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java index 0d7d93d9..a8aa0e3f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/javamail/thunderbird/package-info.java @@ -41,4 +41,4 @@ *

    Warning:Only for reading and without file locking or new * messages management. */ -package fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.javamail.thunderbird; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java index 1c172be3..ea143551 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreElement.java @@ -46,7 +46,6 @@ import static fr.gouv.vitam.tools.mailextractlib.store.microsoft.MicrosoftStoreMessageAttachment.*; public interface MicrosoftStoreElement { - String getEmbeddedMessageScheme(); // try to get the best attachment name @@ -54,16 +53,17 @@ static String getAttachementFilename(MicrosoftStoreMessageAttachment nativeAttac String result; result = nativeAttachment.longFilename; - if (result.isEmpty()) - result = nativeAttachment.filename; - if (result.isEmpty()) - result = nativeAttachment.displayName; + if (result.isEmpty()) result = nativeAttachment.filename; + if (result.isEmpty()) result = nativeAttachment.displayName; return result; } // utility function to extract attachment from different types of microsoft container (pst message, pst appointment, msg) - static List getAttachments(StoreElement element, MicrosoftStoreMessageAttachment[] nativeAttachments) throws InterruptedException { + static List getAttachments( + StoreElement element, + MicrosoftStoreMessageAttachment[] nativeAttachments + ) throws InterruptedException { List result = new ArrayList(); int attachmentNumber; try { @@ -85,10 +85,17 @@ static List getAttachments(StoreElement element, MicrosoftStore element.logMessageWarning("mailextractlib.microsoft: can't extract OLE attachment", null); break; case ATTACHMENT_METHOD_BY_VALUE: - attachment = new StoreAttachment(element,nativeAttachments[i].byteArray, "file", - getAttachementFilename(nativeAttachments[i]), nativeAttachments[i].creationTime, - nativeAttachments[i].modificationTime, nativeAttachments[i].mimeTag, - nativeAttachments[i].contentId, StoreAttachment.INLINE_ATTACHMENT); + attachment = new StoreAttachment( + element, + nativeAttachments[i].byteArray, + "file", + getAttachementFilename(nativeAttachments[i]), + nativeAttachments[i].creationTime, + nativeAttachments[i].modificationTime, + nativeAttachments[i].mimeTag, + nativeAttachments[i].contentId, + StoreAttachment.INLINE_ATTACHMENT + ); result.add(attachment); break; case ATTACHMENT_METHOD_BY_REFERENCE: @@ -99,19 +106,28 @@ static List getAttachments(StoreElement element, MicrosoftStore break; case ATTACHMENT_METHOD_EMBEDDED: if (element instanceof MicrosoftStoreElement) { - attachment = new StoreAttachment(element, nativeAttachments[i].embeddedMessage, - ((MicrosoftStoreElement)element).getEmbeddedMessageScheme(), getAttachementFilename(nativeAttachments[i]), nativeAttachments[i].creationTime, - nativeAttachments[i].modificationTime, nativeAttachments[i].mimeTag, - nativeAttachments[i].contentId, StoreAttachment.STORE_ATTACHMENT); + attachment = new StoreAttachment( + element, + nativeAttachments[i].embeddedMessage, + ((MicrosoftStoreElement) element).getEmbeddedMessageScheme(), + getAttachementFilename(nativeAttachments[i]), + nativeAttachments[i].creationTime, + nativeAttachments[i].modificationTime, + nativeAttachments[i].mimeTag, + nativeAttachments[i].contentId, + StoreAttachment.STORE_ATTACHMENT + ); result.add(attachment); } break; } } catch (Exception e) { - element.logMessageWarning("mailextractlib.microsoft: can't get attachment number " + Integer.toString(i), e); + element.logMessageWarning( + "mailextractlib.microsoft: can't get attachment number " + Integer.toString(i), + e + ); } } - return result; + return result; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java index 7acc26c9..6c7344dd 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessage.java @@ -41,7 +41,6 @@ import fr.gouv.vitam.tools.mailextractlib.core.StoreMessage; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; import fr.gouv.vitam.tools.mailextractlib.utils.RFC822Headers; - import jakarta.mail.MessagingException; import java.time.Instant; @@ -86,76 +85,75 @@ public MicrosoftStoreMessage(StoreFolder mBFolder) { public long getMessageSize() { long result; result = getNativeMessageSize(); - if ((result == 0) && (mimeContent != null)) - result = mimeContent.length; + if ((result == 0) && (mimeContent != null)) result = mimeContent.length; return result; } // Native message fields access functions - abstract protected String getNativeSmtpTransportHeader() throws InterruptedException; + protected abstract String getNativeSmtpTransportHeader() throws InterruptedException; - abstract protected String getNativeSubject() throws InterruptedException; + protected abstract String getNativeSubject() throws InterruptedException; - abstract protected String getNativeInternetMessageId() throws InterruptedException; + protected abstract String getNativeInternetMessageId() throws InterruptedException; - abstract protected String getNativeSenderName() throws InterruptedException; + protected abstract String getNativeSenderName() throws InterruptedException; - abstract protected String getNativeSentRepresentingName() throws InterruptedException; + protected abstract String getNativeSentRepresentingName() throws InterruptedException; - abstract protected String getNativeSenderAddrType() throws InterruptedException; + protected abstract String getNativeSenderAddrType() throws InterruptedException; - abstract protected String getNativeSenderEmailAddress() throws InterruptedException; + protected abstract String getNativeSenderEmailAddress() throws InterruptedException; - abstract protected String getNativeSentRepresentingAddrType() throws InterruptedException; + protected abstract String getNativeSentRepresentingAddrType() throws InterruptedException; - abstract protected String getNativeSentRepresentingEmailAddress() throws InterruptedException; + protected abstract String getNativeSentRepresentingEmailAddress() throws InterruptedException; - abstract protected String getNativeReturnPath() throws InterruptedException; + protected abstract String getNativeReturnPath() throws InterruptedException; - abstract protected Date getNativeMessageDeliveryTime(); + protected abstract Date getNativeMessageDeliveryTime(); - abstract protected Date getNativeClientSubmitTime(); + protected abstract Date getNativeClientSubmitTime(); - abstract protected String getNativeInReplyToId() throws InterruptedException; + protected abstract String getNativeInReplyToId() throws InterruptedException; - abstract protected long getNativeMessageSize(); + protected abstract long getNativeMessageSize(); // Native message ConversationIndex access functions - abstract protected boolean hasNativeConversationIndex(); + protected abstract boolean hasNativeConversationIndex(); - abstract protected Date getNativeCIDeliveryTime(); + protected abstract Date getNativeCIDeliveryTime(); - abstract protected UUID getNativeCIGuid(); + protected abstract UUID getNativeCIGuid(); - abstract protected int getNativeCINumberOfResponseLevels(); + protected abstract int getNativeCINumberOfResponseLevels(); - abstract protected short getNativeCIResponseLevelDeltaCode(int responseLevelNumber); + protected abstract short getNativeCIResponseLevelDeltaCode(int responseLevelNumber); - abstract protected long getNativeCIResponseLevelTimeDelta(int responseLevelNumber); + protected abstract long getNativeCIResponseLevelTimeDelta(int responseLevelNumber); - abstract protected short getNativeCIResponseLevelRandom(int responseLevelNumber); + protected abstract short getNativeCIResponseLevelRandom(int responseLevelNumber); // Native message Recipients access functions - abstract protected int getNativeNumberOfRecipients(); + protected abstract int getNativeNumberOfRecipients(); - abstract protected String getNativeRecipientsSmtpAddress(int recipientNumber); + protected abstract String getNativeRecipientsSmtpAddress(int recipientNumber); - abstract protected String getNativeRecipientsEmailAddress(int recipientNumber); + protected abstract String getNativeRecipientsEmailAddress(int recipientNumber); - abstract protected String getNativeRecipientsDisplayName(int recipientNumber); + protected abstract String getNativeRecipientsDisplayName(int recipientNumber); - abstract protected int getNativeRecipientsType(int recipientNumber); + protected abstract int getNativeRecipientsType(int recipientNumber); // Native message body access functions - abstract protected String getNativeBodyText(); + protected abstract String getNativeBodyText(); - abstract protected String getNativeBodyHTML(); + protected abstract String getNativeBodyHTML(); - abstract protected String getNativeRTFBody(); + protected abstract String getNativeRTFBody(); // Native message attachment access functions - abstract protected MicrosoftStoreMessageAttachment[] getNativeAttachments(); + protected abstract MicrosoftStoreMessageAttachment[] getNativeAttachments(); // General Headers function @@ -176,15 +174,14 @@ protected void prepareAnalyze() throws InterruptedException { if (!hasRFC822Headers()) { headerString = getNativeSmtpTransportHeader(); - if ((headerString != null) && (!headerString.isEmpty())) - try { - rfc822Headers = new RFC822Headers(headerString, this); - mailHeader = Collections.list(rfc822Headers.getAllHeaderLines()); - } catch (MessagingException e) { - logMessageWarning("mailextractlib.microsoft: can't decode smtp header", e); - rfc822Headers = null; - mailHeader = null; - } + if ((headerString != null) && (!headerString.isEmpty())) try { + rfc822Headers = new RFC822Headers(headerString, this); + mailHeader = Collections.list(rfc822Headers.getAllHeaderLines()); + } catch (MessagingException e) { + logMessageWarning("mailextractlib.microsoft: can't decode smtp header", e); + rfc822Headers = null; + mailHeader = null; + } } nativeAttachments = getNativeAttachments(); } @@ -204,11 +201,12 @@ protected void analyzeSubject() throws InterruptedException { // smtp header value String[] sList = rfc822Headers.getHeader("Subject"); if (sList != null) { - if (sList.length > 1) - logMessageWarning("mailextractlib.microsoft: multiple subjects, keep the first one in header", null); + if (sList.length > 1) logMessageWarning( + "mailextractlib.microsoft: multiple subjects, keep the first one in header", + null + ); result = RFC822Headers.getHeaderValue(sList[0]); - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(result); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible(result); } } else { // pst file value @@ -223,12 +221,14 @@ protected void analyzeSubject() throws InterruptedException { result = result.substring(2); } } - if (result.isEmpty()) - result = null; + if (result.isEmpty()) result = null; } - if (result == null) - doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, - "mailextractlib.microsoft: no subject in header", null); + if (result == null) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.MESSAGE_DETAILS, + "mailextractlib.microsoft: no subject in header", + null + ); subject = result; } @@ -248,8 +248,10 @@ protected void analyzeMessageID() throws InterruptedException { // smtp header value String[] mList = rfc822Headers.getHeader("message-ID"); if (mList != null) { - if (mList.length > 1) - logMessageWarning("mailextractlib.microsoft: multiple message ID, keep the first one in header", null); + if (mList.length > 1) logMessageWarning( + "mailextractlib.microsoft: multiple message ID, keep the first one in header", + null + ); result = RFC822Headers.getHeaderValue(mList[0]); } } else { @@ -271,9 +273,7 @@ protected void analyzeMessageID() throws InterruptedException { result += ">"; } } - } - // FIXME AN pst to test - catch (Exception e) { + } catch (Exception e) { // FIXME AN pst to test logMessageWarning("mailextractlib.microsoft: error during Message ID extraction", e); result = "NoMessageID"; } @@ -292,11 +292,9 @@ private String getSenderName() throws InterruptedException { String result; result = getNativeSenderName(); - if ((result == null) || result.isEmpty()) - result = getNativeSentRepresentingName(); + if ((result == null) || result.isEmpty()) result = getNativeSentRepresentingName(); - if (result.isEmpty()) - result = null; + if (result.isEmpty()) result = null; return result; } @@ -305,30 +303,23 @@ private String getSenderName() throws InterruptedException { private String getSenderEmailAddress() throws InterruptedException { String result = ""; - if (getNativeSenderAddrType().equalsIgnoreCase("SMTP")) - result = getNativeSenderEmailAddress(); - if (result.isEmpty() && getNativeSentRepresentingAddrType().equalsIgnoreCase("SMTP")) - result = getNativeSentRepresentingEmailAddress(); - if (result.isEmpty()) - result = getNativeSenderEmailAddress(); - if (result.isEmpty()) - result = getNativeSentRepresentingEmailAddress(); - - if (result.isEmpty()) - result = null; + if (getNativeSenderAddrType().equalsIgnoreCase("SMTP")) result = getNativeSenderEmailAddress(); + if (result.isEmpty() && getNativeSentRepresentingAddrType().equalsIgnoreCase("SMTP")) result = + getNativeSentRepresentingEmailAddress(); + if (result.isEmpty()) result = getNativeSenderEmailAddress(); + if (result.isEmpty()) result = getNativeSentRepresentingEmailAddress(); + + if (result.isEmpty()) result = null; return result; } static String getFormattedAddress(String name, String smtpAddress) { - String result=null; + String result = null; - if (name != null){ - if (smtpAddress != null) - result = name + " <" + smtpAddress + ">"; - else - result = name; - } - else { + if (name != null) { + if (smtpAddress != null) result = name + " <" + smtpAddress + ">"; + else result = name; + } else { result = smtpAddress; } return result; @@ -346,8 +337,7 @@ protected void analyzeFrom() throws InterruptedException { // smtp header value String[] fromArray = rfc822Headers.getHeader("From"); if (fromArray != null) { - if (fromArray.length == 1) - result = RFC822Headers.getHeaderValue(fromArray[0]); + if (fromArray.length == 1) result = RFC822Headers.getHeaderValue(fromArray[0]); else { List fromList = new ArrayList<>(); for (String header : fromArray) { @@ -356,23 +346,19 @@ protected void analyzeFrom() throws InterruptedException { fromList = RFC822Headers.removeInvalidAndDuplicatesFromAddressesList(fromList); if (fromList.size() > 1) { result = String.join(", ", fromList); - logMessageWarning( - "mailextractlib.microsoft: multiple From addresses [" + result + "]", null); - } else - result = fromList.get(0); + logMessageWarning("mailextractlib.microsoft: multiple From addresses [" + result + "]", null); + } else result = fromList.get(0); } - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(result); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible(result); } } else { // pst file value String fromName = getSenderName(); String fromAddress = getSenderEmailAddress(); - result=getFormattedAddress(fromName,fromAddress); + result = getFormattedAddress(fromName, fromAddress); } - if (result == null) - logMessageWarning("mailextractlib.microsoft: no From address in header", null); + if (result == null) logMessageWarning("mailextractlib.microsoft: no From address in header", null); from = result; } @@ -413,9 +399,9 @@ protected void analyzeRecipients() throws InterruptedException { try { // prefer smtp address String emailAddress = getNativeRecipientsSmtpAddress(i); - if ((emailAddress == null) || (emailAddress.isEmpty())) - emailAddress = getNativeRecipientsEmailAddress(i); - normAddress = getFormattedAddress(getNativeRecipientsDisplayName(i),emailAddress); + if ((emailAddress == null) || (emailAddress.isEmpty())) emailAddress = + getNativeRecipientsEmailAddress(i); + normAddress = getFormattedAddress(getNativeRecipientsDisplayName(i), emailAddress); switch (getNativeRecipientsType(i)) { case MAPI_TO: recipientTo.add(normAddress); @@ -434,7 +420,7 @@ protected void analyzeRecipients() throws InterruptedException { } } -// ReplyTo specific functions + // ReplyTo specific functions /* * (non-Javadoc) @@ -454,7 +440,7 @@ protected void analyzeReplyTo() throws InterruptedException { replyTo = result; } -// Return-Path specific functions + // Return-Path specific functions /* * (non-Javadoc) @@ -469,8 +455,7 @@ protected void analyzeReturnPath() throws InterruptedException { // smtp header value String[] rpArray = rfc822Headers.getHeader("Return-Path"); if (rpArray != null) { - if (rpArray.length == 1) - result = RFC822Headers.getHeaderValue(rpArray[0]); + if (rpArray.length == 1) result = RFC822Headers.getHeaderValue(rpArray[0]); else { List rpList = new ArrayList<>(); for (String header : rpArray) { @@ -480,12 +465,12 @@ protected void analyzeReturnPath() throws InterruptedException { if (rpList.size() > 1) { result = String.join(", ", rpList); logMessageWarning( - "mailextractlib.microsoft: multiple Return-Path addresses [" + result + "]", null); - } else - result = rpList.get(0); + "mailextractlib.microsoft: multiple Return-Path addresses [" + result + "]", + null + ); + } else result = rpList.get(0); } - if ((result != null) && (result.contains("=?"))) - result = decodeRfc2047Flexible(result); + if ((result != null) && (result.contains("=?"))) result = decodeRfc2047Flexible(result); } } // if not in the SMTP header there's no microsoft version @@ -493,7 +478,7 @@ protected void analyzeReturnPath() throws InterruptedException { returnPath = result; } -// Dates specific functions + // Dates specific functions /* * (non-Javadoc) @@ -505,7 +490,7 @@ protected void analyzeDates() { sentDate = getNativeClientSubmitTime(); } -// In-reply-to and References specific functions + // In-reply-to and References specific functions /* * (non-Javadoc) @@ -521,22 +506,21 @@ protected void analyzeInReplyToId() throws InterruptedException { // smtp header value String[] irtList = rfc822Headers.getHeader("In-Reply-To"); if (irtList != null) { - if (irtList.length > 1) - logMessageWarning( - "mailextractlib.microsoft: multiple In-Reply-To identifiers, keep the first one in header", null); + if (irtList.length > 1) logMessageWarning( + "mailextractlib.microsoft: multiple In-Reply-To identifiers, keep the first one in header", + null + ); result = RFC822Headers.getHeaderValue(irtList[0]); } } else { // pst file value result = getNativeInReplyToId(); if (result.isEmpty()) { - if (messageID == null) - analyzeMessageID(); + if (messageID == null) analyzeMessageID(); if ((messageID != null) && messageID.startsWith(" messageID.lastIndexOf('@')) { result = messageID.substring(0, messageID.lastIndexOf('+')) + ">"; - } else - result = null; + } else result = null; } } } @@ -562,7 +546,7 @@ protected void analyzeReferences() { references = result; } -// Content analysis methods + // Content analysis methods /* * (non-Javadoc) @@ -575,20 +559,17 @@ protected void analyzeBodies() { // text result = getNativeBodyText(); - if (result.isEmpty()) - result = null; + if (result.isEmpty()) result = null; bodyContent[TEXT_BODY] = result; // html result = getNativeBodyHTML(); - if (result.isEmpty()) - result = null; + if (result.isEmpty()) result = null; bodyContent[HTML_BODY] = result; // rtf result = getNativeRTFBody(); - if (result.isEmpty()) - result = null; + if (result.isEmpty()) result = null; bodyContent[RTF_BODY] = result; } @@ -603,6 +584,7 @@ protected void analyzeBodies() { protected void analyzeAttachments() throws InterruptedException { attachments = MicrosoftStoreElement.getAttachments(this, nativeAttachments); } + // Global message /** @@ -613,5 +595,4 @@ protected void analyzeAttachments() throws InterruptedException { protected byte[] getNativeMimeContent() { return null; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java index f63d9aba..bbcf435e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/MicrosoftStoreMessageAttachment.java @@ -101,7 +101,5 @@ public class MicrosoftStoreMessageAttachment { /** * Instantiates a new microsoft store message attachment. */ - public MicrosoftStoreMessageAttachment() { - } - + public MicrosoftStoreMessageAttachment() {} } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java index 3c56bfc6..63592ccc 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgConversationIndex.java @@ -49,6 +49,7 @@ * @author Nick Buller */ public class MsgConversationIndex { + private static final int HUNDRED_NS_TO_MS = 1000; private static final int MINIMUM_HEADER_SIZE = 22; private static final int RESPONSE_LEVEL_SIZE = 5; @@ -177,7 +178,6 @@ protected MsgConversationIndex(final byte[] rawConversationIndex) { } private static long convertBigEndianBytesToLong(final byte[] data, final int start, final int end) { - long offset = 0; for (int x = start; x < end; ++x) { offset = offset << 8; @@ -200,7 +200,7 @@ private static long convertBigEndianBytesToLong(final byte[] data, final int sta private static final long EPOCH_DIFF = 11644473600000L; private static Date filetimeToDate(final int high, final int low) { - final long filetime = ((long) high) << 32 | (low & 0xffffffffL); + final long filetime = (((long) high) << 32) | (low & 0xffffffffL); final long ms_since_16010101 = filetime / (1000 * 10); final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF; return new Date(ms_since_19700101); @@ -226,10 +226,12 @@ private void decodeResponseLevel(final byte[] rawConversationIndex) { final int responseLevelCount = (rawConversationIndex.length - MINIMUM_HEADER_SIZE) / RESPONSE_LEVEL_SIZE; this.responseLevels = new ArrayList<>(responseLevelCount); - for (int responseLevelIndex = 0, position = 22; responseLevelIndex < responseLevelCount; responseLevelIndex++, position += RESPONSE_LEVEL_SIZE) { - - final long responseLevelValue = convertBigEndianBytesToLong(rawConversationIndex, position, - position + 5); + for ( + int responseLevelIndex = 0, position = 22; + responseLevelIndex < responseLevelCount; + responseLevelIndex++, position += RESPONSE_LEVEL_SIZE + ) { + final long responseLevelValue = convertBigEndianBytesToLong(rawConversationIndex, position, position + 5); final short deltaCode = (short) (responseLevelValue >> 39); final short random = (short) (responseLevelValue & 0xFF); diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java index b93cd4ba..5c6e88a6 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreExtractor.java @@ -62,8 +62,8 @@ public class MsgStoreExtractor extends StoreExtractor { * This is in default list. */ public static void subscribeStoreExtractor() { - addExtractionRelation("application/vnd.ms-outlook", "x-fmt/430","msg", false, MsgStoreExtractor.class); - addExtractionRelation(null, null,"msg.embeddedmsg", false, MsgStoreExtractor.class); + addExtractionRelation("application/vnd.ms-outlook", "x-fmt/430", "msg", false, MsgStoreExtractor.class); + addExtractionRelation(null, null, "msg.embeddedmsg", false, MsgStoreExtractor.class); } // Attachment to complete with decoded form @@ -81,8 +81,14 @@ public static void subscribeStoreExtractor() { * @throws MailExtractLibException the extraction exception * @throws InterruptedException the interrupted exception */ - public MsgStoreExtractor(String urlString, String folder, String destPathString, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, MailExtractProgressLogger logger) throws MailExtractLibException, InterruptedException { + public MsgStoreExtractor( + String urlString, + String folder, + String destPathString, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + MailExtractProgressLogger logger + ) throws MailExtractLibException, InterruptedException { super(urlString, folder, destPathString, options, rootStoreExtractor, null, logger); MAPIMessage message; long size; @@ -93,7 +99,9 @@ public MsgStoreExtractor(String urlString, String folder, String destPathString, size = Files.size(messageFile.toPath()); } catch (Exception e) { throw new MailExtractLibException( - "mailextractlib.msg: can't open " + path + ", doesn't exist or is not a msg file", e); + "mailextractlib.msg: can't open " + path + ", doesn't exist or is not a msg file", + e + ); } ArchiveUnit rootNode = new ArchiveUnit(this, destRootPath, destName); @@ -112,14 +120,27 @@ public MsgStoreExtractor(String urlString, String folder, String destPathString, * @throws MailExtractLibException the extraction exception * @throws InterruptedException the interrupted exception */ - public MsgStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, StoreElement fatherElement, MailExtractProgressLogger logger) throws MailExtractLibException, InterruptedException { - super("msg.embeddedmsg://localhost/", "", rootNode.getFullName(), options, rootStoreExtractor, fatherElement, logger); + public MsgStoreExtractor( + StoreAttachment attachment, + ArchiveUnit rootNode, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + StoreElement fatherElement, + MailExtractProgressLogger logger + ) throws MailExtractLibException, InterruptedException { + super( + "msg.embeddedmsg://localhost/", + "", + rootNode.getFullName(), + options, + rootStoreExtractor, + fatherElement, + logger + ); MAPIMessage message; this.attachment = attachment; - if (attachment.getStoreContent() instanceof MAPIMessage) - message = (MAPIMessage) attachment.getStoreContent(); + if (attachment.getStoreContent() instanceof MAPIMessage) message = (MAPIMessage) attachment.getStoreContent(); else if (attachment.getStoreContent() instanceof byte[]) { ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) attachment.getStoreContent()); try { @@ -127,8 +148,7 @@ else if (attachment.getStoreContent() instanceof byte[]) { } catch (IOException e) { throw new MailExtractLibException("mailextractlib.msg: can't extract msg store", e); } - } else - throw new MailExtractLibException("mailextractlib.msg: can't extract msg store", null); + } else throw new MailExtractLibException("mailextractlib.msg: can't extract msg store", null); setRootFolder(MsgStoreFolder.createRootFolder(this, message, 0, rootNode)); } @@ -152,8 +172,16 @@ public boolean canExtractObjectsLists() { /** * The Constant MSG_MN. */ - static final byte[] MSG_MN = new byte[]{(byte) 0xD0, (byte) 0xCF, 0x11, (byte) 0xE0, (byte) 0xA1, (byte) 0xB1, - 0x1A, (byte) 0xE1}; + static final byte[] MSG_MN = new byte[] { + (byte) 0xD0, + (byte) 0xCF, + 0x11, + (byte) 0xE0, + (byte) 0xA1, + (byte) 0xB1, + 0x1A, + (byte) 0xE1, + }; /** * Gets the verified scheme. @@ -164,7 +192,6 @@ public boolean canExtractObjectsLists() { public static String getVerifiedScheme(byte[] content) { if (hasMagicNumber(content, MSG_MN)) { return "msg"; - } else - return null; + } else return null; } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java index 8e292e47..5a7cadd3 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreFolder.java @@ -37,8 +37,8 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; -import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; +import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import org.apache.poi.hsmf.MAPIMessage; @@ -61,9 +61,9 @@ public class MsgStoreFolder extends StoreFolder { * @param size the size * @throws InterruptedException the interrupted exception */ - public MsgStoreFolder(MsgStoreExtractor storeExtractor, MAPIMessage message, long size) throws InterruptedException { + public MsgStoreFolder(MsgStoreExtractor storeExtractor, MAPIMessage message, long size) + throws InterruptedException { super(storeExtractor); - this.msgStoreMessage = new MsgStoreMessage(this, message, size); } @@ -77,8 +77,12 @@ public MsgStoreFolder(MsgStoreExtractor storeExtractor, MAPIMessage message, lon * @return the LP store folder * @throws InterruptedException the interrupted exception */ - public static MsgStoreFolder createRootFolder(MsgStoreExtractor storeExtractor, MAPIMessage message, long size, - ArchiveUnit rootArchiveUnit) throws InterruptedException { + public static MsgStoreFolder createRootFolder( + MsgStoreExtractor storeExtractor, + MAPIMessage message, + long size, + ArchiveUnit rootArchiveUnit + ) throws InterruptedException { MsgStoreFolder result = new MsgStoreFolder(storeExtractor, message, size); result.folderArchiveUnit = rootArchiveUnit; @@ -118,8 +122,9 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE if (attachment != null) { attachment.setStoreContent(msgStoreMessage.getMimeContent()); attachment.setMimeType("message/rfc822"); - if ((attachment.getName() == null) || attachment.getName().isEmpty()) - attachment.setName(msgStoreMessage.getSubject() + ".eml"); + if ((attachment.getName() == null) || attachment.getName().isEmpty()) attachment.setName( + msgStoreMessage.getSubject() + ".eml" + ); } } @@ -131,8 +136,7 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE * int, boolean) */ @Override - protected void doExtractSubFolders(int level, boolean writeFlag) throws MailExtractLibException { - } + protected void doExtractSubFolders(int level, boolean writeFlag) throws MailExtractLibException {} /* * (non-Javadoc) @@ -174,6 +178,5 @@ protected void doListFolderElements(boolean stats) throws MailExtractLibExceptio * boolean) */ @Override - protected void doListSubFolders(boolean stats) throws MailExtractLibException { - } + protected void doListSubFolders(boolean stats) throws MailExtractLibException {} } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java index a88bd1ed..c499607c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessage.java @@ -168,8 +168,7 @@ private void getConversationIndex() throws InterruptedException { byte[] byteConversationIndex = getByteItem(CONVERSATION_INDEX); if (byteConversationIndex != null) { msgConversationIndex = new MsgConversationIndex(byteConversationIndex); - if (msgConversationIndex.getGuid() == null) - msgConversationIndex = null; + if (msgConversationIndex.getGuid() == null) msgConversationIndex = null; } } @@ -188,13 +187,15 @@ private String getStringItem(int item) throws InterruptedException { if (lChunk != null) { if (lChunk.size() > 1) { - logMessageWarning("mailextractlib.msg: multiple MSG object [" + prop.name + "], keep the first one", null); + logMessageWarning( + "mailextractlib.msg: multiple MSG object [" + prop.name + "], keep the first one", + null + ); } if (lChunk.get(0) instanceof StringChunk) { StringChunk sChunk = (StringChunk) lChunk.get(0); result = sChunk.getValue(); - } else - logMessageWarning("mailextractlib.msg: unexpected MSG object type [" + prop.name + "]", null); + } else logMessageWarning("mailextractlib.msg: unexpected MSG object type [" + prop.name + "]", null); } return result; } @@ -206,13 +207,15 @@ private byte[] getByteItem(int item) throws InterruptedException { if (lChunk != null) { if (lChunk.size() > 1) { - logMessageWarning("mailextractlib.msg: multiple MSG object [" + prop.name + "], keep the first one", null); + logMessageWarning( + "mailextractlib.msg: multiple MSG object [" + prop.name + "], keep the first one", + null + ); } if (lChunk.get(0) instanceof ByteChunk) { ByteChunk bChunk = (ByteChunk) lChunk.get(0); result = bChunk.getValue(); - } else - logMessageWarning("mailextractlib.msg: unexpected MSG object type [" + prop.name + "]", null); + } else logMessageWarning("mailextractlib.msg: unexpected MSG object type [" + prop.name + "]", null); } return result; } @@ -224,8 +227,7 @@ private Date getDateItem(int item) { if (lVal != null) { Calendar cal = (Calendar) lVal.get(0).getValue(); - if (cal != null) - result = cal.getTime(); + if (cal != null) result = cal.getTime(); } return result; } @@ -427,8 +429,11 @@ protected String getNativeRecipientsDisplayName(int recipientNumber) { */ @Override protected int getNativeRecipientsType(int recipientNumber) { - return (int) message.getRecipientDetailsChunks()[recipientNumber].getProperties() - .get(MAPIProperty.RECIPIENT_TYPE).get(0).getValue(); + return (int) message + .getRecipientDetailsChunks()[recipientNumber].getProperties() + .get(MAPIProperty.RECIPIENT_TYPE) + .get(0) + .getValue(); } /* (non-Javadoc) diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java index 447e674b..ee0899ac 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/MsgStoreMessageAttachment.java @@ -67,29 +67,23 @@ public MsgStoreMessageAttachment(AttachmentChunks attachmentChunks) { Map> mapProp = spChunk.getProperties(); lVal = mapProp.get(MAPIProperty.ATTACH_SIZE); - if (lVal == null) - size = 0; - else - size = (int) lVal.get(0).getValue(); + if (lVal == null) size = 0; + else size = (int) lVal.get(0).getValue(); lVal = mapProp.get(MAPIProperty.ATTACH_METHOD); - if (lVal == null) - attachMethod = 0; - else - attachMethod = (int) lVal.get(0).getValue(); + if (lVal == null) attachMethod = 0; + else attachMethod = (int) lVal.get(0).getValue(); lVal = mapProp.get(MAPIProperty.CREATION_TIME); if (lVal != null) { Calendar cal = (Calendar) lVal.get(0).getValue(); - if (cal != null) - creationTime = cal.getTime(); + if (cal != null) creationTime = cal.getTime(); } lVal = mapProp.get(MAPIProperty.LAST_MODIFICATION_TIME); if (lVal != null) { Calendar cal = (Calendar) lVal.get(0).getValue(); - if (cal != null) - modificationTime = cal.getTime(); + if (cal != null) modificationTime = cal.getTime(); } } else if ((chunk instanceof StringChunk) && (chunk.getChunkId() == MAPIProperty.DISPLAY_NAME.id)) { displayName = ((StringChunk) chunk).getValue(); @@ -97,23 +91,17 @@ public MsgStoreMessageAttachment(AttachmentChunks attachmentChunks) { } byteArray = attachmentChunks.getEmbeddedAttachmentObject(); tmpSC = attachmentChunks.getAttachFileName(); - if (tmpSC != null) - filename = tmpSC.getValue(); + if (tmpSC != null) filename = tmpSC.getValue(); try { embeddedMessage = attachmentChunks.getEmbeddedMessage(); } catch (IOException e) { // forget it } tmpSC = attachmentChunks.getAttachLongFileName(); - if (tmpSC != null) - longFilename = tmpSC.getValue(); + if (tmpSC != null) longFilename = tmpSC.getValue(); tmpSC = attachmentChunks.getAttachMimeTag(); - if (tmpSC != null) - mimeTag = tmpSC.getValue(); + if (tmpSC != null) mimeTag = tmpSC.getValue(); tmpSC = attachmentChunks.getAttachContentId(); - if (tmpSC != null) - contentId = tmpSC.getValue(); - + if (tmpSC != null) contentId = tmpSC.getValue(); } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java index e0919e42..e5713e08 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/msg/package-info.java @@ -50,4 +50,4 @@ * Excel solution (for Excel 97-2008). We have a complete API for porting other * OOXML and OLE2 formats and welcome others to participate. */ -package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.microsoft.msg; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java index 289f853b..86daac71 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/package-info.java @@ -40,4 +40,4 @@ *

    * Package for Microsoft extraction and, when possible, abstraction for pst and msg classes. */ -package fr.gouv.vitam.tools.mailextractlib.store.microsoft; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.microsoft; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java index eaa89715..3fd18d9e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreAppointment.java @@ -105,21 +105,24 @@ protected PstStoreAppointment(PstStoreFolder pstStoreFolder, PSTAppointment appo * @param isRecurrenceDeletion the is recurrence deletion * @param exceptionDate the exception date */ - protected PstStoreAppointment(StoreFolder storeFolder, String uniqId, - int sequenceNumber, - String subject, - String location, - String from, - String toAttendees, - String ccAttendees, - ZonedDateTime startTime, - ZonedDateTime endTime, - String miscNotes, - String otherMiscNotes, - int messageStatus, - List attachments, - boolean isRecurrenceDeletion, - ZonedDateTime exceptionDate) { + protected PstStoreAppointment( + StoreFolder storeFolder, + String uniqId, + int sequenceNumber, + String subject, + String location, + String from, + String toAttendees, + String ccAttendees, + ZonedDateTime startTime, + ZonedDateTime endTime, + String miscNotes, + String otherMiscNotes, + int messageStatus, + List attachments, + boolean isRecurrenceDeletion, + ZonedDateTime exceptionDate + ) { super(storeFolder); this.uniqId = uniqId; this.sequenceNumber = sequenceNumber; @@ -143,7 +146,6 @@ protected PstStoreAppointment(StoreFolder storeFolder, String uniqId, this.exceptionDate = exceptionDate; } - /* (non-Javadoc) * @see fr.gouv.vitam.tools.mailextractlib.store.microsoft.MicrosoftStoreMessage#getEmbeddedMessageScheme() */ @@ -155,12 +157,10 @@ public String getEmbeddedMessageScheme() { private String getUniqId() { String result; PSTGlobalObjectId id = appointment.getCleanGlobalObjectId(); - if (id == null) - result = appointment.getGlobalObjectId().toString(); + if (id == null) result = appointment.getGlobalObjectId().toString(); else { - result=id.toString(); - if (result.isEmpty()) - result = appointment.getGlobalObjectId().toString(); + result = id.toString(); + if (result.isEmpty()) result = appointment.getGlobalObjectId().toString(); } return result; } @@ -169,25 +169,28 @@ private static String getFrom(PSTAppointment appointment) { String fromAddr = appointment.getSenderEmailAddress(); String fromName = appointment.getSenderName(); String result = ""; - if ((fromName != null) && !fromName.isEmpty()) - result = fromName + " "; - if ((fromAddr != null) && !fromAddr.isEmpty()) - result += "<" + fromAddr + ">"; + if ((fromName != null) && !fromName.isEmpty()) result = fromName + " "; + if ((fromAddr != null) && !fromAddr.isEmpty()) result += "<" + fromAddr + ">"; return result.trim(); } - static HashMap normalizedZoneIdMap=new HashMap<>(); - private ZoneId getNormalizedZoneId(Date date,PSTTimeZone pstTimeZone) throws InterruptedException { - ZoneId result=normalizedZoneIdMap.get(pstTimeZone.getName()); - if (result!=null) - return result; + static HashMap normalizedZoneIdMap = new HashMap<>(); + + private ZoneId getNormalizedZoneId(Date date, PSTTimeZone pstTimeZone) throws InterruptedException { + ZoneId result = normalizedZoneIdMap.get(pstTimeZone.getName()); + if (result != null) return result; try { - result=ZoneId.of(pstTimeZone.getName()); - } - catch (DateTimeException e) { - result = ZoneOffset.ofTotalSeconds(pstTimeZone.getSimpleTimeZone().getOffset(date.getTime())/1000); - logMessageWarning("mailextractlib: can't determine time zone id ["+pstTimeZone.getName()+ - "], replace by "+result.toString()+" format", null); + result = ZoneId.of(pstTimeZone.getName()); + } catch (DateTimeException e) { + result = ZoneOffset.ofTotalSeconds(pstTimeZone.getSimpleTimeZone().getOffset(date.getTime()) / 1000); + logMessageWarning( + "mailextractlib: can't determine time zone id [" + + pstTimeZone.getName() + + "], replace by " + + result.toString() + + " format", + null + ); } normalizedZoneIdMap.put(pstTimeZone.getName(), result); return result; @@ -195,10 +198,8 @@ private ZoneId getNormalizedZoneId(Date date,PSTTimeZone pstTimeZone) throws Int private ZonedDateTime getZonedDateTime(Date date, PSTTimeZone pstTimeZone) throws InterruptedException { ZoneId zoneId; - if (pstTimeZone == null) - zoneId = ZoneId.of("UTC"); - else - zoneId = getNormalizedZoneId(date,pstTimeZone); + if (pstTimeZone == null) zoneId = ZoneId.of("UTC"); + else zoneId = getNormalizedZoneId(date, pstTimeZone); return ZonedDateTime.ofInstant(date.toInstant(), zoneId); } @@ -215,37 +216,34 @@ private void analyzeMiscNotes() throws InterruptedException { if (htmlExtractor.isEncapsulatedTEXTinRTF()) { test = htmlExtractor.getDeEncapsulateHTMLFromRTF(); - if (text.isEmpty()) - text=test; - else if (!text.equals(test)) - logMessageWarning("mailextractlib: rtf version different from text version, rtf version dropped",null); + if (text.isEmpty()) text = test; + else if (!text.equals(test)) logMessageWarning( + "mailextractlib: rtf version different from text version, rtf version dropped", + null + ); rtf = ""; } else if (htmlExtractor.isEncapsulatedHTMLinRTF()) { test = htmlExtractor.getDeEncapsulateHTMLFromRTF(); - if (html.isEmpty()) - html=test; - else if (!html.equals(test)) - logMessageWarning("mailextractlib: rtf version different from html version, rtf version dropped",null); + if (html.isEmpty()) html = test; + else if (!html.equals(test)) logMessageWarning( + "mailextractlib: rtf version different from html version, rtf version dropped", + null + ); rtf = ""; - } - else { - test=htmlExtractor.getDeEncapsulateHTMLFromRTF().trim(); - if (test.isEmpty()) - rtf=""; + } else { + test = htmlExtractor.getDeEncapsulateHTMLFromRTF().trim(); + if (test.isEmpty()) rtf = ""; } } } catch (PSTException | IOException | MailExtractLibException ignored) { //ignore } - test=HTMLTextExtractor.getInstance().act(html).trim(); - if (test.isEmpty()) - html=""; + test = HTMLTextExtractor.getInstance().act(html).trim(); + if (test.isEmpty()) html = ""; miscNotes = text; - if (!html.isEmpty()) - otherMiscNotes = html; - else - otherMiscNotes = rtf; + if (!html.isEmpty()) otherMiscNotes = html; + else otherMiscNotes = rtf; } private List getAttachments(PSTMessage message) throws InterruptedException { @@ -253,58 +251,64 @@ private List getAttachments(PSTMessage message) throws Interrup for (int i = 0; i < message.getNumberOfAttachments(); i++) { try { final PSTMessage child = message.getAttachment(i).getEmbeddedPSTMessage(); - if (child instanceof PSTAppointment) - continue; + if (child instanceof PSTAppointment) continue; } catch (PSTException | IOException ignored) { //ignore } nativeAttachments.add(new PstStoreMessageAttachment(message, i)); } - if (nativeAttachments.isEmpty()) - return new ArrayList<>(0); - return MicrosoftStoreElement.getAttachments(this, nativeAttachments.toArray(new MicrosoftStoreMessageAttachment[0])); + if (nativeAttachments.isEmpty()) return new ArrayList<>(0); + return MicrosoftStoreElement.getAttachments( + this, + nativeAttachments.toArray(new MicrosoftStoreMessageAttachment[0]) + ); } private int getMessageStatus() { - String messageClass=appointment.getMessageClass(); - if (messageClass.contains("Appointment")) - return MESSAGE_STATUS_LOCAL; - else if (messageClass.contains("Meeting.Request")) - return MESSAGE_STATUS_REQUEST; - else if (messageClass.contains("Meeting.Resp.Pos")) - return MESSAGE_STATUS_RESPONSE_YES; - else if (messageClass.contains("Meeting.Resp.Tent")) - return MESSAGE_STATUS_RESPONSE_MAY; - else if (messageClass.contains("Meeting.Resp.Neg")) - return MESSAGE_STATUS_RESPONSE_NO; - else - return MESSAGE_STATUS_UNKNOWN; + String messageClass = appointment.getMessageClass(); + if (messageClass.contains("Appointment")) return MESSAGE_STATUS_LOCAL; + else if (messageClass.contains("Meeting.Request")) return MESSAGE_STATUS_REQUEST; + else if (messageClass.contains("Meeting.Resp.Pos")) return MESSAGE_STATUS_RESPONSE_YES; + else if (messageClass.contains("Meeting.Resp.Tent")) return MESSAGE_STATUS_RESPONSE_MAY; + else if (messageClass.contains("Meeting.Resp.Neg")) return MESSAGE_STATUS_RESPONSE_NO; + else return MESSAGE_STATUS_UNKNOWN; } private StoreAppointment generateDeletionAppointment(ZonedDateTime zdt) { - PstStoreAppointment result= new PstStoreAppointment(storeFolder, - uniqId, sequenceNumber, subject, location, from, toAttendees, ccAttendees, - null, null, "", "",messageStatus, null, - true, zdt); - result.listLineId=getStoreExtractor().incElementCounter(this.getClass()); + PstStoreAppointment result = new PstStoreAppointment( + storeFolder, + uniqId, + sequenceNumber, + subject, + location, + from, + toAttendees, + ccAttendees, + null, + null, + "", + "", + messageStatus, + null, + true, + zdt + ); + result.listLineId = getStoreExtractor().incElementCounter(this.getClass()); return result; } private String getChangedFrom(PSTAppointmentException exception) { - if (exception.getEmbeddedMessage() == null) - return this.from; + if (exception.getEmbeddedMessage() == null) return this.from; return getFrom(exception.getEmbeddedMessage()); } private String getChangedToAttendees(PSTAppointmentException exception) { - if (exception.getEmbeddedMessage() == null) - return this.toAttendees; + if (exception.getEmbeddedMessage() == null) return this.toAttendees; return exception.getEmbeddedMessage().getToAttendees(); } private String getChangedCCAttendees(PSTAppointmentException exception) { - if (exception.getEmbeddedMessage() == null) - return this.ccAttendees; + if (exception.getEmbeddedMessage() == null) return this.ccAttendees; return exception.getEmbeddedMessage().getCCAttendees(); } @@ -312,28 +316,33 @@ private ZonedDateTime getChangedZonedDateTime(ZonedDateTime zdt, Date d) { return ZonedDateTime.ofInstant(d.toInstant(), zdt.getZone()); } - private StoreAppointment generateExceptionAppointment(ZonedDateTime zdt, PSTAppointmentException exception) throws InterruptedException { - PstStoreAppointment result = new PstStoreAppointment(storeFolder, - uniqId, sequenceNumber, - exception.getSubject(), - exception.getLocation(), - getChangedFrom(exception), - getChangedToAttendees(exception), - getChangedCCAttendees(exception), - getChangedZonedDateTime(startTime, exception.getStartDate()), - getChangedZonedDateTime(startTime, exception.getEndDate()), - "", "", - messageStatus, - null, - false, - zdt); + private StoreAppointment generateExceptionAppointment(ZonedDateTime zdt, PSTAppointmentException exception) + throws InterruptedException { + PstStoreAppointment result = new PstStoreAppointment( + storeFolder, + uniqId, + sequenceNumber, + exception.getSubject(), + exception.getLocation(), + getChangedFrom(exception), + getChangedToAttendees(exception), + getChangedCCAttendees(exception), + getChangedZonedDateTime(startTime, exception.getStartDate()), + getChangedZonedDateTime(startTime, exception.getEndDate()), + "", + "", + messageStatus, + null, + false, + zdt + ); // special treatment when embedded message if (exception.getEmbeddedMessage() != null) { result.appointment = exception.getEmbeddedMessage(); result.analyzeMiscNotes(); - result.attachments=getAttachments(result.appointment); + result.attachments = getAttachments(result.appointment); } - result.listLineId=getStoreExtractor().incElementCounter(this.getClass()); + result.listLineId = getStoreExtractor().incElementCounter(this.getClass()); return result; } @@ -351,23 +360,26 @@ public void analyzeAppointment() throws MailExtractLibException, InterruptedExce analyzeMiscNotes(); attachments = getAttachments(appointment); sequenceNumber = appointment.getAppointmentSequence(); - modificationTime=getZonedDateTime(appointment.getLastModificationTime(),null); + modificationTime = getZonedDateTime(appointment.getLastModificationTime(), null); messageStatus = getMessageStatus(); if (appointment.isRecurring()) { - PSTTimeZone tz=appointment.getRecurrenceTimeZone(); - if (tz==null) - tz=new PSTTimeZone("Unknown", PSTTimeZone.utcTimeZone); - PSTAppointmentRecurrence par = new PSTAppointmentRecurrence(appointment.getRecurrenceStructure(), appointment,tz); + PSTTimeZone tz = appointment.getRecurrenceTimeZone(); + if (tz == null) tz = new PSTTimeZone("Unknown", PSTTimeZone.utcTimeZone); + PSTAppointmentRecurrence par = new PSTAppointmentRecurrence( + appointment.getRecurrenceStructure(), + appointment, + tz + ); recurencePattern = appointment.getRecurrencePattern(); startRecurrenceTime = getZonedDateTime(par.getStartDate(), appointment.getRecurrenceTimeZone()); endRecurrenceTime = getZonedDateTime(par.getEndDate(), appointment.getRecurrenceTimeZone()); exceptions = new ArrayList(10); for (Date d : par.getDeletedInstanceDates()) { - ZonedDateTime zdt=getZonedDateTime(d, par.getTimeZone()); + ZonedDateTime zdt = getZonedDateTime(d, par.getTimeZone()); exceptions.add(generateDeletionAppointment(zdt)); } for (int i = 0; i < par.getExceptionCount(); i++) { - ZonedDateTime zdt=getZonedDateTime(par.getModifiedInstanceDates()[i], par.getTimeZone()); + ZonedDateTime zdt = getZonedDateTime(par.getModifiedInstanceDates()[i], par.getTimeZone()); exceptions.add(generateExceptionAppointment(zdt, par.getException(i))); } } else { diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java index 5bbf8cff..72567575 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreContact.java @@ -46,7 +46,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.PrintStream; import java.util.LinkedHashSet; /** @@ -79,23 +78,18 @@ private String getFullName() { String tmp1, tmp2; tmp1 = contact.getAccount(); tmp2 = contact.getDisplayName(); - if ((tmp1 == null) || tmp1.isEmpty()) - return tmp2; - if ((tmp2 == null) || tmp2.isEmpty()) - return tmp1; - if (tmp1.toLowerCase().equals(tmp2.toLowerCase())) - return tmp1; + if ((tmp1 == null) || tmp1.isEmpty()) return tmp2; + if ((tmp2 == null) || tmp2.isEmpty()) return tmp1; + if (tmp1.toLowerCase().equals(tmp2.toLowerCase())) return tmp1; return tmp1 + "/" + tmp2; } private String getStringFromSet(LinkedHashSet set) { String result = ""; for (String s : set) { - if ((s != null) && !s.isEmpty()) - result += s + ";"; + if ((s != null) && !s.isEmpty()) result += s + ";"; } - if (!result.isEmpty()) - result = result.substring(0, result.length() - 1); + if (!result.isEmpty()) result = result.substring(0, result.length() - 1); return result; } @@ -145,40 +139,31 @@ private String getTitle() { String tmp1, tmp2; tmp1 = contact.getTitle(); tmp2 = contact.getProfession(); - if ((tmp1 == null) || tmp1.isEmpty()) - return tmp2; - if ((tmp2 == null) || tmp2.isEmpty()) - return tmp1; - if (tmp1.toLowerCase().equals(tmp2.toLowerCase())) - return tmp1; + if ((tmp1 == null) || tmp1.isEmpty()) return tmp2; + if ((tmp2 == null) || tmp2.isEmpty()) return tmp1; + if (tmp1.toLowerCase().equals(tmp2.toLowerCase())) return tmp1; return tmp1 + "/" + tmp2; } private String getBusinessAddress() { String tmp, line = "", result = ""; tmp = contact.getBusinessAddressStreet(); - if (!tmp.isEmpty()) - result = "L1:" + tmp + "\n"; + if (!tmp.isEmpty()) result = "L1:" + tmp + "\n"; tmp = contact.getBusinessPostalCode(); - if (!tmp.isEmpty()) - line = tmp + " "; + if (!tmp.isEmpty()) line = tmp + " "; tmp = contact.getBusinessAddressCity(); - if (!tmp.isEmpty()) - line += tmp + " "; + if (!tmp.isEmpty()) line += tmp + " "; tmp = contact.getBusinessPoBox(); - if (!tmp.isEmpty()) - line += "POB:" + tmp + " "; + if (!tmp.isEmpty()) line += "POB:" + tmp + " "; if (!line.isEmpty()) { result += "L2:" + line.substring(0, line.length() - 1) + "\n"; line = ""; } tmp = contact.getBusinessAddressCountry(); - if (!tmp.isEmpty()) - line += tmp; + if (!tmp.isEmpty()) line += tmp; tmp = contact.getBusinessAddressStateOrProvince(); if (!tmp.isEmpty() && !tmp.toLowerCase().equals(line.toLowerCase())) { - if (line.isEmpty()) - line = tmp; + if (line.isEmpty()) line = tmp; else line += "/" + tmp; } if (!line.isEmpty()) { @@ -190,28 +175,22 @@ private String getBusinessAddress() { private String getHomeAddress() { String tmp, line = "", result = ""; tmp = contact.getHomeAddressStreet(); - if (!tmp.isEmpty()) - result = "L1:" + tmp + "\n"; + if (!tmp.isEmpty()) result = "L1:" + tmp + "\n"; tmp = contact.getHomeAddressPostalCode(); - if (!tmp.isEmpty()) - line = tmp + " "; + if (!tmp.isEmpty()) line = tmp + " "; tmp = contact.getHomeAddressCity(); - if (!tmp.isEmpty()) - line += tmp + " "; + if (!tmp.isEmpty()) line += tmp + " "; if (!line.isEmpty()) { result += "L2:" + line.substring(0, line.length() - 1) + "\n"; line = ""; } tmp = contact.getHomeAddressPostOfficeBox(); - if (!tmp.isEmpty()) - line += "POB:" + tmp + " "; + if (!tmp.isEmpty()) line += "POB:" + tmp + " "; tmp = contact.getHomeAddressCountry(); - if (!tmp.isEmpty()) - line += tmp; + if (!tmp.isEmpty()) line += tmp; tmp = contact.getHomeAddressStateOrProvince(); if (!tmp.isEmpty() && !tmp.toLowerCase().equals(line.toLowerCase())) { - if (line.isEmpty()) - line = tmp; + if (line.isEmpty()) line = tmp; else line += "/" + tmp; } if (!line.isEmpty()) { @@ -247,7 +226,6 @@ public void analyzeAllContactInformations() throws MailExtractLibException, Inte homeTelephoneNumbers = getHomeTelephoneNumbers(); homeAddress = getHomeAddress(); nickName = contact.getNickname(); - // are not extracted the following values from java-libpst // getCallbackTelephoneNumber, getInitials, getKeyword, getLanguage, getMhsCommonName, // getOrganizationalIdNumber, getMiddleName, getDisplayNamePrefix, getPreferredByName, @@ -262,8 +240,7 @@ public void analyzeAllContactInformations() throws MailExtractLibException, Inte public void analyzeContactPicture() throws MailExtractLibException, InterruptedException { pictureFileName = null; pictureData = null; - if (contact.getNumberOfAttachments() == 0) - return; + if (contact.getNumberOfAttachments() == 0) return; for (int i = 0; i < contact.getNumberOfAttachments(); i++) { PSTAttachment attachment; @@ -285,8 +262,7 @@ public void analyzeContactPicture() throws MailExtractLibException, InterruptedE pictureFileName = null; } } - } catch (PSTException | IOException ignored) { - } + } catch (PSTException | IOException ignored) {} } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java index 150ab4c0..d438f770 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreExtractor.java @@ -40,10 +40,10 @@ import fr.gouv.vitam.tools.javalibpst.PSTException; import fr.gouv.vitam.tools.javalibpst.PSTFile; import fr.gouv.vitam.tools.javalibpst.PSTFolder; +import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.core.StoreElement; import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractorOptions; -import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; @@ -65,8 +65,8 @@ public class PstStoreExtractor extends StoreExtractor { * This is in default list. */ public static void subscribeStoreExtractor() { - addExtractionRelation("application/vnd.ms-outlook-pst", "x-fmt/248","pst", true, PstStoreExtractor.class); - addExtractionRelation("application/vnd.ms-outlook-pst", "x-fmt/249","pst", true, PstStoreExtractor.class); + addExtractionRelation("application/vnd.ms-outlook-pst", "x-fmt/248", "pst", true, PstStoreExtractor.class); + addExtractionRelation("application/vnd.ms-outlook-pst", "x-fmt/249", "pst", true, PstStoreExtractor.class); } // Attachment to complete with decoded form @@ -96,15 +96,22 @@ public static void subscribeStoreExtractor() { * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major * format problems...) */ - public PstStoreExtractor(String urlString, String storeFolder, String destPathString, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, MailExtractProgressLogger logger) throws MailExtractLibException { + public PstStoreExtractor( + String urlString, + String storeFolder, + String destPathString, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + MailExtractProgressLogger logger + ) throws MailExtractLibException { super(urlString, storeFolder, destPathString, options, rootStoreExtractor, null, logger); - try { pstFile = new PSTFile(path); } catch (Exception e) { throw new MailExtractLibException( - "mailextractlib.pst: can't open " + path + ", doesn't exist or is not a pst file", e); + "mailextractlib.pst: can't open " + path + ", doesn't exist or is not a pst file", + e + ); } pstFile.setGlobalCodepage(options.defaultCharsetName); @@ -116,9 +123,10 @@ public PstStoreExtractor(String urlString, String storeFolder, String destPathSt try { PSTFolder pstFolder = findChildFolder(pstFile.getRootFolder(), storeFolder); - if (pstFolder == null) - throw new MailExtractLibException( - "mailextractlib.pst: can't find the root folder " + storeFolder + " in pst file", null); + if (pstFolder == null) throw new MailExtractLibException( + "mailextractlib.pst: can't find the root folder " + storeFolder + " in pst file", + null + ); lPRootMailBoxFolder = PstStoreFolder.createRootFolder(this, pstFolder, rootNode); @@ -126,7 +134,10 @@ public PstStoreExtractor(String urlString, String storeFolder, String destPathSt } catch (IOException e) { throw new MailExtractLibException("mailextractlib.pst: can't use " + path + " pst file", e); } catch (PSTException e) { - throw new MailExtractLibException("mailextractlib.pst: can't find extraction root folder " + storeFolder, e); + throw new MailExtractLibException( + "mailextractlib.pst: can't find extraction root folder " + storeFolder, + e + ); } } @@ -139,25 +150,27 @@ private static File writeStoreFile(String dirPath, byte[] byteContent) throws Ma Files.createDirectories(Paths.get(dirPath)); storeFile = getStoreTemporaryFile(dirPath); output = new BufferedOutputStream(new FileOutputStream(storeFile)); - if (byteContent != null) - output.write(byteContent); + if (byteContent != null) output.write(byteContent); } catch (IOException ex) { - if (dirPath.length() + 8 > 250) - throw new MailExtractLibException( - "mailextractlib.pst: store file extraction illegal destination file (may be too long pathname), extracting unit in path " - + dirPath, ex); - else - throw new MailExtractLibException( - "mailextractlib.pst: store file extraction illegal destination file, extracting unit in path " - + dirPath, ex); + if (dirPath.length() + 8 > 250) throw new MailExtractLibException( + "mailextractlib.pst: store file extraction illegal destination file (may be too long pathname), extracting unit in path " + + dirPath, + ex + ); + else throw new MailExtractLibException( + "mailextractlib.pst: store file extraction illegal destination file, extracting unit in path " + + dirPath, + ex + ); } finally { - if (output != null) - try { - output.close(); - } catch (IOException e) { - throw new MailExtractLibException( - "mailextractlib.pst: can't close store file extraction, extracting unit in path " + dirPath, e); - } + if (output != null) try { + output.close(); + } catch (IOException e) { + throw new MailExtractLibException( + "mailextractlib.pst: can't close store file extraction, extracting unit in path " + dirPath, + e + ); + } } return (storeFile); @@ -170,7 +183,7 @@ private static File getStoreTemporaryFile(String destPathString) { // generate temporary file and create the url to it private static String generateFileAndUrl(StoreAttachment attachment, ArchiveUnit rootNode) - throws MailExtractLibException { + throws MailExtractLibException { String result = null; File storeFile = writeStoreFile(rootNode.getFullName(), attachment.getRawAttachmentContent()); try { @@ -181,7 +194,8 @@ private static String generateFileAndUrl(StoreAttachment attachment, ArchiveUnit return result; } - private void deleteStoreFileAndContainerAndThrowException(String message, Exception e) throws MailExtractLibException { + private void deleteStoreFileAndContainerAndThrowException(String message, Exception e) + throws MailExtractLibException { if (storeFile != null) { try { Files.deleteIfExists(storeFile.toPath()); @@ -190,7 +204,10 @@ private void deleteStoreFileAndContainerAndThrowException(String message, Except Files.deleteIfExists(parentDirectory.toPath()); } } catch (IOException ee) { - throw new MailExtractLibException(message + ", and unable to suppress temporary files ("+ee.getMessage()+")", e); + throw new MailExtractLibException( + message + ", and unable to suppress temporary files (" + ee.getMessage() + ")", + e + ); } } throw new MailExtractLibException(message, e); @@ -207,17 +224,33 @@ private void deleteStoreFileAndContainerAndThrowException(String message, Except * @param logger logger used * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) */ - public PstStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, StoreExtractorOptions options, - StoreExtractor rootStoreExtractor, StoreElement fatherElement, MailExtractProgressLogger logger) throws MailExtractLibException { - super(generateFileAndUrl(attachment, rootNode), "", rootNode.getFullName(), options, rootStoreExtractor, fatherElement, logger); - + public PstStoreExtractor( + StoreAttachment attachment, + ArchiveUnit rootNode, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + StoreElement fatherElement, + MailExtractProgressLogger logger + ) throws MailExtractLibException { + super( + generateFileAndUrl(attachment, rootNode), + "", + rootNode.getFullName(), + options, + rootStoreExtractor, + fatherElement, + logger + ); this.attachment = attachment; this.storeFile = new File(path); try { pstFile = new PSTFile(path); } catch (Exception e) { - deleteStoreFileAndContainerAndThrowException("mailextractlib.pst: can't open " + path + ", doesn't exist or is not a pst file",e); + deleteStoreFileAndContainerAndThrowException( + "mailextractlib.pst: can't open " + path + ", doesn't exist or is not a pst file", + e + ); } PstStoreFolder lPRootMailBoxFolder; @@ -226,7 +259,10 @@ public PstStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, Store PSTFolder pstFolder = findChildFolder(pstFile.getRootFolder(), ""); if (pstFolder == null) { - deleteStoreFileAndContainerAndThrowException("mailextractlib.pst: Can't find the root folder in pst file", null); + deleteStoreFileAndContainerAndThrowException( + "mailextractlib.pst: Can't find the root folder in pst file", + null + ); } lPRootMailBoxFolder = PstStoreFolder.createRootFolder(this, pstFolder, rootNode); @@ -257,18 +293,15 @@ private PSTFolder findChildFolder(PSTFolder father, String folderFullName) throw String regex; PSTFolder result = father; - if ((folderFullName == null) || (folderFullName.isEmpty())) - return result; + if ((folderFullName == null) || (folderFullName.isEmpty())) return result; else { regex = File.separator; - if (regex.equals("\\")) - regex = "\\\\"; + if (regex.equals("\\")) regex = "\\\\"; String[] folderHierarchy = folderFullName.split(regex); for (int i = 0; i < folderHierarchy.length; i++) { if (!folderHierarchy[i].isEmpty()) { result = getNamedSubFolder(result, folderHierarchy[i]); - if (result == null) - break; + if (result == null) break; } } return result; @@ -282,14 +315,14 @@ private PSTFolder findChildFolder(PSTFolder father, String folderFullName) throw public void endStoreExtractor() throws MailExtractLibException { super.endStoreExtractor(); try { - if (pstFile!=null) - pstFile.close(); + if (pstFile != null) pstFile.close(); } catch (IOException e) { throw new MailExtractLibException("mailextractlib.pst: Can't close temporary file tmpstore", e); } - if ((storeFile != null) && - !storeFile.delete()) - throw new MailExtractLibException("mailextractlib.pst: Can't delete temporary file tmpstore", null); + if ((storeFile != null) && !storeFile.delete()) throw new MailExtractLibException( + "mailextractlib.pst: Can't delete temporary file tmpstore", + null + ); } /* (non-Javadoc) @@ -311,7 +344,7 @@ public boolean canExtractObjectsLists() { /** * The Constant PST_MN. */ - static final byte[] PST_MN = new byte[]{0x21, 0x42, 0x44, 0x4e}; + static final byte[] PST_MN = new byte[] { 0x21, 0x42, 0x44, 0x4e }; /** * Gets the verified scheme. @@ -322,8 +355,6 @@ public boolean canExtractObjectsLists() { public static String getVerifiedScheme(byte[] content) { if (hasMagicNumber(content, PST_MN)) { return "pst"; - } else - return null; + } else return null; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java index add359ee..07f1fa13 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreFolder.java @@ -79,12 +79,9 @@ private PstStoreFolder(StoreExtractor storeExtractor, PSTFolder pstFolder, PstSt super(storeExtractor); this.pstFolder = pstFolder; this.name = pstFolder.getDisplayName(); - if (this.name == null) - this.name = ""; - if (father.getFullName().isEmpty()) - this.fullName = this.name; - else - this.fullName = father.fullName + File.separator + this.name; + if (this.name == null) this.name = ""; + if (father.getFullName().isEmpty()) this.fullName = this.name; + else this.fullName = father.fullName + File.separator + this.name; finalizeStoreFolder(father); } @@ -96,8 +93,11 @@ private PstStoreFolder(StoreExtractor storeExtractor, PSTFolder pstFolder, PstSt * @param rootArchiveUnit Root ArchiveUnit * @return the LP store folder */ - public static PstStoreFolder createRootFolder(PstStoreExtractor storeExtractor, PSTFolder pstFolder, - ArchiveUnit rootArchiveUnit) { + public static PstStoreFolder createRootFolder( + PstStoreExtractor storeExtractor, + PSTFolder pstFolder, + ArchiveUnit rootArchiveUnit + ) { PstStoreFolder result = new PstStoreFolder(storeExtractor, pstFolder); result.folderArchiveUnit = rootArchiveUnit; @@ -105,10 +105,13 @@ public static PstStoreFolder createRootFolder(PstStoreExtractor storeExtractor, } private void logMessageWarning(String msg, Exception e) throws InterruptedException { - if (getStoreExtractor().getOptions().warningMsgProblem) - doProgressLog(getProgressLogger(), MailExtractProgressLogger.WARNING, msg, e); - else - doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, e); + if (getStoreExtractor().getOptions().warningMsgProblem) doProgressLog( + getProgressLogger(), + MailExtractProgressLogger.WARNING, + msg, + e + ); + else doProgressLog(getProgressLogger(), MailExtractProgressLogger.MESSAGE_DETAILS, msg, e); } private PSTMessage getNextPSTObject(int count) throws MailExtractLibException, InterruptedException { @@ -121,14 +124,23 @@ private PSTMessage getNextPSTObject(int count) throws MailExtractLibException, I } catch (IOException e) { throw new MailExtractLibException("mailextractlib.pst: can't use pst file", e); } catch (PSTException e) { - throw new MailExtractLibException("mailextractlib.pst: can't get elements from folder " + getFullName(), e); + throw new MailExtractLibException( + "mailextractlib.pst: can't get elements from folder " + getFullName(), + e + ); } catch (Exception e) { - logMessageWarning("mailextractlib.pst: end folder operation at message " + count - + "/" + pstFolder.getContentCount() + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: end folder operation at message " + + count + + "/" + + pstFolder.getContentCount() + + " in folder " + + this.getName(), + e + ); error = true; } - } - while (error); + } while (error); return (PSTMessage) po; } @@ -141,8 +153,10 @@ private void extractPSTObject(PSTMessage message, int count, boolean writeFlag) } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't extract contact " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't extract contact " + count + " in folder " + this.getName(), + e + ); } } else if (message instanceof PSTAppointment) { try { @@ -151,8 +165,10 @@ private void extractPSTObject(PSTMessage message, int count, boolean writeFlag) } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't extract appointment " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't extract appointment " + count + " in folder " + this.getName(), + e + ); } } else { try { @@ -161,8 +177,10 @@ private void extractPSTObject(PSTMessage message, int count, boolean writeFlag) } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't extract message " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't extract message " + count + " in folder " + this.getName(), + e + ); } } } @@ -187,28 +205,33 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE while (true) { final int messageRank = submittedTasks + 1; // Task index message = getNextPSTObject(messageRank); - if (message == null) - break; + if (message == null) break; final PSTMessage msg = message; completionService.submit(() -> { extractPSTObject(msg, messageRank, writeFlag); return null; }); - submittedTasks=messageRank; + submittedTasks = messageRank; } // Retrieve the results with a maximum wait of 60 seconds per task for (int i = 0; i < submittedTasks; i++) { Future future = completionService.poll(60, TimeUnit.SECONDS); if (future == null) { - throw new MailExtractLibException("mailextractlib.pst: Timeout: no message extracted within 60 seconds, folder extraction aborted.", null); + throw new MailExtractLibException( + "mailextractlib.pst: Timeout: no message extracted within 60 seconds, folder extraction aborted.", + null + ); } try { - future.get(); // Retrieve the task result or propagate any exception + future.get(); // Retrieve the task result or propagate any exception } catch (ExecutionException e) { - MailExtractProgressLogger.doProgressLogWithoutInterruption(getStoreExtractor().getProgressLogger(), - MailExtractProgressLogger.MESSAGE, - "mailextractlib.pst: Error during a message processing, it's dropped.", e); + MailExtractProgressLogger.doProgressLogWithoutInterruption( + getStoreExtractor().getProgressLogger(), + MailExtractProgressLogger.MESSAGE, + "mailextractlib.pst: Error during a message processing, it's dropped.", + e + ); } } } finally { @@ -218,8 +241,7 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE int messageCount = 1; while (true) { message = getNextPSTObject(messageCount); - if (message == null) - break; + if (message == null) break; extractPSTObject(message, messageCount, writeFlag); messageCount++; } @@ -234,16 +256,15 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE * int) */ @Override - protected void doExtractSubFolders(int level, boolean writeFlag) throws - MailExtractLibException, InterruptedException { + protected void doExtractSubFolders(int level, boolean writeFlag) + throws MailExtractLibException, InterruptedException { PstStoreFolder lPMailBoxSubFolder; try { final Vector subfolders = pstFolder.getSubFolders(); for (final PSTFolder subfolder : subfolders) { lPMailBoxSubFolder = new PstStoreFolder(storeExtractor, subfolder, this); - if (lPMailBoxSubFolder.extractFolder(level + 1, writeFlag)) - incFolderSubFoldersCount(); + if (lPMailBoxSubFolder.extractFolder(level + 1, writeFlag)) incFolderSubFoldersCount(); extendDateRange(lPMailBoxSubFolder.getDateRange()); } } catch (IOException e) { @@ -308,8 +329,10 @@ private void listPSTObject(PSTMessage message, int count, boolean stats) throws } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't list contact " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't list contact " + count + " in folder " + this.getName(), + e + ); } } else if (message instanceof PSTAppointment) { try { @@ -318,8 +341,10 @@ private void listPSTObject(PSTMessage message, int count, boolean stats) throws } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't list appointment " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't list appointment " + count + " in folder " + this.getName(), + e + ); } } else { try { @@ -328,8 +353,10 @@ private void listPSTObject(PSTMessage message, int count, boolean stats) throws } catch (InterruptedException e) { throw e; } catch (Exception e) { - logMessageWarning("mailextractlib.pst: can't list message " + count - + " in folder " + this.getName(), e); + logMessageWarning( + "mailextractlib.pst: can't list message " + count + " in folder " + this.getName(), + e + ); } } } @@ -354,28 +381,33 @@ protected void doListFolderElements(boolean stats) throws MailExtractLibExceptio while (true) { final int messageRank = submittedTasks + 1; // Task index message = getNextPSTObject(messageRank); - if (message == null) - break; + if (message == null) break; final PSTMessage msg = message; completionService.submit(() -> { listPSTObject(msg, messageRank, stats); return null; }); - submittedTasks=messageRank; + submittedTasks = messageRank; } // Retrieve the results with a maximum wait of 60 seconds per task for (int i = 0; i < submittedTasks; i++) { Future future = completionService.poll(60, TimeUnit.SECONDS); if (future == null) { - throw new MailExtractLibException("mailextractlib.pst: Timeout: no message listed within 60 seconds, folder extraction aborted.", null); + throw new MailExtractLibException( + "mailextractlib.pst: Timeout: no message listed within 60 seconds, folder extraction aborted.", + null + ); } try { - future.get(); // Retrieve the task result or propagate any exception + future.get(); // Retrieve the task result or propagate any exception } catch (ExecutionException e) { - MailExtractProgressLogger.doProgressLogWithoutInterruption(getStoreExtractor().getProgressLogger(), - MailExtractProgressLogger.MESSAGE, - "mailextractlib.pst: Error during a message processing, it's dropped.", e); + MailExtractProgressLogger.doProgressLogWithoutInterruption( + getStoreExtractor().getProgressLogger(), + MailExtractProgressLogger.MESSAGE, + "mailextractlib.pst: Error during a message processing, it's dropped.", + e + ); } } } finally { @@ -385,8 +417,7 @@ protected void doListFolderElements(boolean stats) throws MailExtractLibExceptio int messageCount = 1; while (true) { message = getNextPSTObject(messageCount); - if (message == null) - break; + if (message == null) break; listPSTObject(message, messageCount, stats); messageCount++; } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java index ff169a9c..f5fb36d7 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/PstStoreMessage.java @@ -37,7 +37,6 @@ */ package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; -import fr.gouv.vitam.tools.javalibpst.PSTAppointment; import fr.gouv.vitam.tools.javalibpst.PSTConversationIndex.ResponseLevel; import fr.gouv.vitam.tools.javalibpst.PSTException; import fr.gouv.vitam.tools.javalibpst.PSTMessage; @@ -47,8 +46,6 @@ import fr.gouv.vitam.tools.mailextractlib.store.microsoft.MicrosoftStoreMessageAttachment; import java.io.IOException; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; import java.util.Date; import java.util.List; import java.util.UUID; @@ -220,10 +217,8 @@ protected UUID getNativeCIGuid() { protected int getNativeCINumberOfResponseLevels() { List lResponseLevel = message.getConversationIndex().getResponseLevels(); - if (lResponseLevel == null) - return 0; - else - return lResponseLevel.size(); + if (lResponseLevel == null) return 0; + else return lResponseLevel.size(); } /* (non-Javadoc) @@ -233,10 +228,8 @@ protected int getNativeCINumberOfResponseLevels() { protected short getNativeCIResponseLevelDeltaCode(int responseLevelNumber) { List lResponseLevel = message.getConversationIndex().getResponseLevels(); - if (lResponseLevel == null) - return 0; - else - return lResponseLevel.get(responseLevelNumber).getDeltaCode(); + if (lResponseLevel == null) return 0; + else return lResponseLevel.get(responseLevelNumber).getDeltaCode(); } /* (non-Javadoc) @@ -246,10 +239,8 @@ protected short getNativeCIResponseLevelDeltaCode(int responseLevelNumber) { protected long getNativeCIResponseLevelTimeDelta(int responseLevelNumber) { List lResponseLevel = message.getConversationIndex().getResponseLevels(); - if (lResponseLevel == null) - return 0; - else - return lResponseLevel.get(responseLevelNumber).getTimeDelta(); + if (lResponseLevel == null) return 0; + else return lResponseLevel.get(responseLevelNumber).getTimeDelta(); } /* (non-Javadoc) @@ -259,10 +250,8 @@ protected long getNativeCIResponseLevelTimeDelta(int responseLevelNumber) { protected short getNativeCIResponseLevelRandom(int responseLevelNumber) { List lResponseLevel = message.getConversationIndex().getResponseLevels(); - if (lResponseLevel == null) - return 0; - else - return lResponseLevel.get(responseLevelNumber).getRandom(); + if (lResponseLevel == null) return 0; + else return lResponseLevel.get(responseLevelNumber).getRandom(); } /* (non-Javadoc) diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java index 2a6e20b0..b41eb9ca 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreExtractor.java @@ -58,7 +58,7 @@ public class PstEmbeddedStoreExtractor extends StoreExtractor { * This is in default list. */ public static void subscribeStoreExtractor() { - addExtractionRelation(null, null,"pst.embeddedmsg", false, PstEmbeddedStoreExtractor.class); + addExtractionRelation(null, null, "pst.embeddedmsg", false, PstEmbeddedStoreExtractor.class); } // Attachment to complete with decoded form @@ -75,13 +75,27 @@ public static void subscribeStoreExtractor() { * @param logger logger used * @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...) */ - public PstEmbeddedStoreExtractor(StoreAttachment attachment, ArchiveUnit rootNode, - StoreExtractorOptions options, StoreExtractor rootStoreExtractor, StoreElement fatherElement, MailExtractProgressLogger logger) - throws MailExtractLibException { - super("pst.embeddedmsg://localhost/", "", rootNode.getFullName(), options, rootStoreExtractor, fatherElement, logger); - + public PstEmbeddedStoreExtractor( + StoreAttachment attachment, + ArchiveUnit rootNode, + StoreExtractorOptions options, + StoreExtractor rootStoreExtractor, + StoreElement fatherElement, + MailExtractProgressLogger logger + ) throws MailExtractLibException { + super( + "pst.embeddedmsg://localhost/", + "", + rootNode.getFullName(), + options, + rootStoreExtractor, + fatherElement, + logger + ); this.attachment = attachment; - setRootFolder(PstEmbeddedStoreFolder.createRootFolder((PSTMessage) attachment.getStoreContent(), this, rootNode)); + setRootFolder( + PstEmbeddedStoreFolder.createRootFolder((PSTMessage) attachment.getStoreContent(), this, rootNode) + ); } /* (non-Javadoc) diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java index aefba9e5..19172500 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/PstEmbeddedStoreFolder.java @@ -38,9 +38,9 @@ package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.embeddedmsg; import fr.gouv.vitam.tools.javalibpst.PSTMessage; +import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; import fr.gouv.vitam.tools.mailextractlib.core.StoreFolder; -import fr.gouv.vitam.tools.mailextractlib.core.StoreAttachment; import fr.gouv.vitam.tools.mailextractlib.nodes.ArchiveUnit; import fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.PstStoreMessage; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; @@ -60,7 +60,6 @@ public class PstEmbeddedStoreFolder extends StoreFolder { // for the root folder private PstEmbeddedStoreFolder(PSTMessage content, StoreExtractor storeExtractor) { super(storeExtractor); - this.lpStoreMessage = new PstStoreMessage(this, content); this.fullName = ""; this.name = ""; @@ -77,8 +76,11 @@ private PstEmbeddedStoreFolder(PSTMessage content, StoreExtractor storeExtractor * Root ArchiveUnit * @return the LP store folder */ - public static PstEmbeddedStoreFolder createRootFolder(PSTMessage content, PstEmbeddedStoreExtractor storeExtractor, - ArchiveUnit rootArchiveUnit) { + public static PstEmbeddedStoreFolder createRootFolder( + PSTMessage content, + PstEmbeddedStoreExtractor storeExtractor, + ArchiveUnit rootArchiveUnit + ) { PstEmbeddedStoreFolder result = new PstEmbeddedStoreFolder(content, storeExtractor); result.folderArchiveUnit = rootArchiveUnit; @@ -99,8 +101,9 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE StoreAttachment attachment = ((PstEmbeddedStoreExtractor) storeExtractor).getAttachment(); attachment.setStoreContent(lpStoreMessage.getMimeContent()); attachment.setMimeType("message/rfc822"); - if ((attachment.getName() == null) || attachment.getName().isEmpty()) - attachment.setName(lpStoreMessage.getSubject() + ".eml"); + if ((attachment.getName() == null) || attachment.getName().isEmpty()) attachment.setName( + lpStoreMessage.getSubject() + ".eml" + ); } /* diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java index 015a2163..fcca9d5e 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/embeddedmsg/package-info.java @@ -38,4 +38,4 @@ /** * Provides all classes to implement a Microsoft .pst embedded message extraction with libpst library. */ -package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.embeddedmsg; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst.embeddedmsg; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java index bbf7fe12..aacced3f 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/store/microsoft/pst/package-info.java @@ -50,4 +50,4 @@ *

    * Thanks to Richard Johnson http://github.com/rjohnsondev */ -package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.store.microsoft.pst; diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java index 0bbfb873..704a3e1d 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/DateRange.java @@ -49,6 +49,7 @@ * it directly contains and of the start and end dates of all its subfolders. */ public class DateRange { + private Date start, end; /** @@ -86,7 +87,7 @@ public DateRange() { * Date * @return the ISO date string */ - static public String getISODateString(Date date) { + public static String getISODateString(Date date) { if (date == null) { return null; } else { @@ -134,10 +135,8 @@ public void extendRange(Date date) { start = date; end = date; } else { - if (start.after(date)) - start = date; - else if (end.before(date)) - end = date; + if (start.after(date)) start = date; + else if (end.before(date)) end = date; } } } @@ -155,10 +154,8 @@ public void extendRange(DateRange dateRange) { start = dateRange.start; end = dateRange.end; } else { - if (start.after(dateRange.start)) - start = dateRange.start; - if (end.before(dateRange.end)) - end = dateRange.end; + if (start.after(dateRange.start)) start = dateRange.start; + if (end.before(dateRange.end)) end = dateRange.end; } } } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java index b9bf78cc..923a70f3 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/HtmlAndXmlEscape.java @@ -49,7 +49,6 @@ */ public class HtmlAndXmlEscape { - /** * Escapes a given string for XML 1.0 compliance. * @@ -87,7 +86,7 @@ public static String escapeXml(String input) { // Ensure a valid low surrogate exists if (i + 1 < length && Character.isLowSurrogate(input.charAt(i + 1))) { sb.append(c).append(input.charAt(i + 1)); - i++; // Skip to the low surrogate + i++; // Skip to the low surrogate continue; } // If unmatched high surrogate, skip it @@ -99,10 +98,11 @@ public static String escapeXml(String input) { continue; } // Invalid characters according to the XML 1.0 specification - if ((c <= 0x1F && c != '\t' && c != '\n' && c != '\r') || - (c >= 0x7F && c <= 0x84) || - (c >= 0x86 && c <= 0x9F)) - continue; // Ignore invalid characters + if ( + (c <= 0x1F && c != '\t' && c != '\n' && c != '\r') || + (c >= 0x7F && c <= 0x84) || + (c >= 0x86 && c <= 0x9F) + ) continue; // Ignore invalid characters switch (c) { case '&': @@ -129,262 +129,262 @@ public static String escapeXml(String input) { } private static final Map UNESCAPE_MAP = Map.ofEntries( - //ISO8859-1 entities - Map.entry("nbsp", ' '), - Map.entry("iexcl", '¡'), - Map.entry("cent", '¢'), - Map.entry("pound", '£'), - Map.entry("curren", '¤'), - Map.entry("yen", '¥'), - Map.entry("brvbar", '¦'), - Map.entry("sect", '§'), - Map.entry("uml", '¨'), - Map.entry("copy", '©'), - Map.entry("ordf", 'ª'), - Map.entry("laquo", '«'), - Map.entry("not", '¬'), - Map.entry("shy", '­'), - Map.entry("reg", '®'), - Map.entry("macr", '¯'), - Map.entry("deg", '°'), - Map.entry("plusmn", '±'), - Map.entry("sup2", '²'), - Map.entry("sup3", '³'), - Map.entry("acute", '´'), - Map.entry("micro", 'µ'), - Map.entry("para", '¶'), - Map.entry("middot", '·'), - Map.entry("cedil", '¸'), - Map.entry("sup1", '¹'), - Map.entry("ordm", 'º'), - Map.entry("raquo", '»'), - Map.entry("frac14", '¼'), - Map.entry("frac12", '½'), - Map.entry("frac34", '¾'), - Map.entry("iquest", '¿'), - Map.entry("Agrave", 'À'), - Map.entry("Aacute", 'Á'), - Map.entry("Acirc", 'Â'), - Map.entry("Atilde", 'Ã'), - Map.entry("Auml", 'Ä'), - Map.entry("Aring", 'Å'), - Map.entry("AElig", 'Æ'), - Map.entry("Ccedil", 'Ç'), - Map.entry("Egrave", 'È'), - Map.entry("Eacute", 'É'), - Map.entry("Ecirc", 'Ê'), - Map.entry("Euml", 'Ë'), - Map.entry("Igrave", 'Ì'), - Map.entry("Iacute", 'Í'), - Map.entry("Icirc", 'Î'), - Map.entry("Iuml", 'Ï'), - Map.entry("ETH", 'Ð'), - Map.entry("Ntilde", 'Ñ'), - Map.entry("Ograve", 'Ò'), - Map.entry("Oacute", 'Ó'), - Map.entry("Ocirc", 'Ô'), - Map.entry("Otilde", 'Õ'), - Map.entry("Ouml", 'Ö'), - Map.entry("times", '×'), - Map.entry("Oslash", 'Ø'), - Map.entry("Ugrave", 'Ù'), - Map.entry("Uacute", 'Ú'), - Map.entry("Ucirc", 'Û'), - Map.entry("Uuml", 'Ü'), - Map.entry("Yacute", 'Ý'), - Map.entry("THORN", 'Þ'), - Map.entry("szlig", 'ß'), - Map.entry("agrave", 'à'), - Map.entry("aacute", 'á'), - Map.entry("acirc", 'â'), - Map.entry("atilde", 'ã'), - Map.entry("auml", 'ä'), - Map.entry("aring", 'å'), - Map.entry("aelig", 'æ'), - Map.entry("ccedil", 'ç'), - Map.entry("egrave", 'è'), - Map.entry("eacute", 'é'), - Map.entry("ecirc", 'ê'), - Map.entry("euml", 'ë'), - Map.entry("igrave", 'ì'), - Map.entry("iacute", 'í'), - Map.entry("icirc", 'î'), - Map.entry("iuml", 'ï'), - Map.entry("eth", 'ð'), - Map.entry("ntilde", 'ñ'), - Map.entry("ograve", 'ò'), - Map.entry("oacute", 'ó'), - Map.entry("ocirc", 'ô'), - Map.entry("otilde", 'õ'), - Map.entry("ouml", 'ö'), - Map.entry("divide", '÷'), - Map.entry("oslash", 'ø'), - Map.entry("ugrave", 'ù'), - Map.entry("uacute", 'ú'), - Map.entry("ucirc", 'û'), - Map.entry("uuml", 'ü'), - Map.entry("yacute", 'ý'), - Map.entry("thorn", 'þ'), - Map.entry("yuml", 'ÿ'), - // HTML40 Extended entities - Map.entry("fnof", 'ƒ'), - Map.entry("Alpha", 'Α'), - Map.entry("Beta", 'Β'), - Map.entry("Gamma", 'Γ'), - Map.entry("Delta", 'Δ'), - Map.entry("Epsilon", 'Ε'), - Map.entry("Zeta", 'Ζ'), - Map.entry("Eta", 'Η'), - Map.entry("Theta", 'Θ'), - Map.entry("Iota", 'Ι'), - Map.entry("Kappa", 'Κ'), - Map.entry("Lambda", 'Λ'), - Map.entry("Mu", 'Μ'), - Map.entry("Nu", 'Ν'), - Map.entry("Xi", 'Ξ'), - Map.entry("Omicron", 'Ο'), - Map.entry("Pi", 'Π'), - Map.entry("Rho", 'Ρ'), - Map.entry("Sigma", 'Σ'), - Map.entry("Tau", 'Τ'), - Map.entry("Upsilon", 'Υ'), - Map.entry("Phi", 'Φ'), - Map.entry("Chi", 'Χ'), - Map.entry("Psi", 'Ψ'), - Map.entry("Omega", 'Ω'), - Map.entry("alpha", 'α'), - Map.entry("beta", 'β'), - Map.entry("gamma", 'γ'), - Map.entry("delta", 'δ'), - Map.entry("epsilon", 'ε'), - Map.entry("zeta", 'ζ'), - Map.entry("eta", 'η'), - Map.entry("theta", 'θ'), - Map.entry("iota", 'ι'), - Map.entry("kappa", 'κ'), - Map.entry("lambda", 'λ'), - Map.entry("mu", 'μ'), - Map.entry("nu", 'ν'), - Map.entry("xi", 'ξ'), - Map.entry("omicron", 'ο'), - Map.entry("pi", 'π'), - Map.entry("rho", 'ρ'), - Map.entry("sigmaf", 'ς'), - Map.entry("sigma", 'σ'), - Map.entry("tau", 'τ'), - Map.entry("upsilon", 'υ'), - Map.entry("phi", 'φ'), - Map.entry("chi", 'χ'), - Map.entry("psi", 'ψ'), - Map.entry("omega", 'ω'), - Map.entry("thetasym", 'ϑ'), - Map.entry("upsih", 'ϒ'), - Map.entry("piv", 'ϖ'), - Map.entry("bull", '•'), - Map.entry("hellip", '…'), - Map.entry("prime", '′'), - Map.entry("Prime", '″'), - Map.entry("oline", '‾'), - Map.entry("frasl", '⁄'), - Map.entry("weierp", '℘'), - Map.entry("image", 'ℑ'), - Map.entry("real", 'ℜ'), - Map.entry("trade", '™'), - Map.entry("alefsym", 'ℵ'), - Map.entry("larr", '←'), - Map.entry("uarr", '↑'), - Map.entry("rarr", '→'), - Map.entry("darr", '↓'), - Map.entry("harr", '↔'), - Map.entry("crarr", '↵'), - Map.entry("lArr", '⇐'), - Map.entry("uArr", '⇑'), - Map.entry("rArr", '⇒'), - Map.entry("dArr", '⇓'), - Map.entry("hArr", '⇔'), - Map.entry("forall", '∀'), - Map.entry("part", '∂'), - Map.entry("exist", '∃'), - Map.entry("empty", '∅'), - Map.entry("nabla", '∇'), - Map.entry("isin", '∈'), - Map.entry("notin", '∉'), - Map.entry("ni", '∋'), - Map.entry("prod", '∏'), - Map.entry("sum", '∑'), - Map.entry("minus", '−'), - Map.entry("lowast", '∗'), - Map.entry("radic", '√'), - Map.entry("prop", '∝'), - Map.entry("infin", '∞'), - Map.entry("ang", '∠'), - Map.entry("and", '∧'), - Map.entry("or", '∨'), - Map.entry("cap", '∩'), - Map.entry("cup", '∪'), - Map.entry("int", '∫'), - Map.entry("there4", '∴'), - Map.entry("sim", '∼'), - Map.entry("cong", '≅'), - Map.entry("asymp", '≈'), - Map.entry("ne", '≠'), - Map.entry("equiv", '≡'), - Map.entry("le", '≤'), - Map.entry("ge", '≥'), - Map.entry("sub", '⊂'), - Map.entry("sup", '⊃'), - Map.entry("nsub", '⊄'), - Map.entry("sube", '⊆'), - Map.entry("supe", '⊇'), - Map.entry("oplus", '⊕'), - Map.entry("otimes", '⊗'), - Map.entry("perp", '⊥'), - Map.entry("sdot", '⋅'), - Map.entry("lceil", '⌈'), - Map.entry("rceil", '⌉'), - Map.entry("lfloor", '⌊'), - Map.entry("rfloor", '⌋'), - Map.entry("lang", '〈'), - Map.entry("rang", '〉'), - Map.entry("loz", '◊'), - Map.entry("spades", '♠'), - Map.entry("clubs", '♣'), - Map.entry("hearts", '♥'), - Map.entry("diams", '♦'), - Map.entry("OElig", 'Œ'), - Map.entry("oelig", 'œ'), - Map.entry("Scaron", 'Š'), - Map.entry("scaron", 'š'), - Map.entry("Yuml", 'Ÿ'), - Map.entry("circ", 'ˆ'), - Map.entry("tilde", '˜'), - Map.entry("ensp", ' '), - Map.entry("emsp", ' '), - Map.entry("thinsp", ' '), - Map.entry("zwnj", '‌'), - Map.entry("zwj", '‍'), - Map.entry("lrm", '‎'), - Map.entry("rlm", '‏'), - Map.entry("ndash", '–'), - Map.entry("mdash", '—'), - Map.entry("lsquo", '‘'), - Map.entry("rsquo", '’'), - Map.entry("sbquo", '‚'), - Map.entry("ldquo", '“'), - Map.entry("rdquo", '”'), - Map.entry("bdquo", '„'), - Map.entry("dagger", '†'), - Map.entry("Dagger", '‡'), - Map.entry("permil", '‰'), - Map.entry("lsaquo", '‹'), - Map.entry("rsaquo", '›'), - Map.entry("euro", '€'), - // XML entities - Map.entry("quot", '"'), - Map.entry("amp", '&'), - Map.entry("lt", '<'), - Map.entry("gt", '>'), - Map.entry("apos", '\'') + //ISO8859-1 entities + Map.entry("nbsp", ' '), + Map.entry("iexcl", '¡'), + Map.entry("cent", '¢'), + Map.entry("pound", '£'), + Map.entry("curren", '¤'), + Map.entry("yen", '¥'), + Map.entry("brvbar", '¦'), + Map.entry("sect", '§'), + Map.entry("uml", '¨'), + Map.entry("copy", '©'), + Map.entry("ordf", 'ª'), + Map.entry("laquo", '«'), + Map.entry("not", '¬'), + Map.entry("shy", '­'), + Map.entry("reg", '®'), + Map.entry("macr", '¯'), + Map.entry("deg", '°'), + Map.entry("plusmn", '±'), + Map.entry("sup2", '²'), + Map.entry("sup3", '³'), + Map.entry("acute", '´'), + Map.entry("micro", 'µ'), + Map.entry("para", '¶'), + Map.entry("middot", '·'), + Map.entry("cedil", '¸'), + Map.entry("sup1", '¹'), + Map.entry("ordm", 'º'), + Map.entry("raquo", '»'), + Map.entry("frac14", '¼'), + Map.entry("frac12", '½'), + Map.entry("frac34", '¾'), + Map.entry("iquest", '¿'), + Map.entry("Agrave", 'À'), + Map.entry("Aacute", 'Á'), + Map.entry("Acirc", 'Â'), + Map.entry("Atilde", 'Ã'), + Map.entry("Auml", 'Ä'), + Map.entry("Aring", 'Å'), + Map.entry("AElig", 'Æ'), + Map.entry("Ccedil", 'Ç'), + Map.entry("Egrave", 'È'), + Map.entry("Eacute", 'É'), + Map.entry("Ecirc", 'Ê'), + Map.entry("Euml", 'Ë'), + Map.entry("Igrave", 'Ì'), + Map.entry("Iacute", 'Í'), + Map.entry("Icirc", 'Î'), + Map.entry("Iuml", 'Ï'), + Map.entry("ETH", 'Ð'), + Map.entry("Ntilde", 'Ñ'), + Map.entry("Ograve", 'Ò'), + Map.entry("Oacute", 'Ó'), + Map.entry("Ocirc", 'Ô'), + Map.entry("Otilde", 'Õ'), + Map.entry("Ouml", 'Ö'), + Map.entry("times", '×'), + Map.entry("Oslash", 'Ø'), + Map.entry("Ugrave", 'Ù'), + Map.entry("Uacute", 'Ú'), + Map.entry("Ucirc", 'Û'), + Map.entry("Uuml", 'Ü'), + Map.entry("Yacute", 'Ý'), + Map.entry("THORN", 'Þ'), + Map.entry("szlig", 'ß'), + Map.entry("agrave", 'à'), + Map.entry("aacute", 'á'), + Map.entry("acirc", 'â'), + Map.entry("atilde", 'ã'), + Map.entry("auml", 'ä'), + Map.entry("aring", 'å'), + Map.entry("aelig", 'æ'), + Map.entry("ccedil", 'ç'), + Map.entry("egrave", 'è'), + Map.entry("eacute", 'é'), + Map.entry("ecirc", 'ê'), + Map.entry("euml", 'ë'), + Map.entry("igrave", 'ì'), + Map.entry("iacute", 'í'), + Map.entry("icirc", 'î'), + Map.entry("iuml", 'ï'), + Map.entry("eth", 'ð'), + Map.entry("ntilde", 'ñ'), + Map.entry("ograve", 'ò'), + Map.entry("oacute", 'ó'), + Map.entry("ocirc", 'ô'), + Map.entry("otilde", 'õ'), + Map.entry("ouml", 'ö'), + Map.entry("divide", '÷'), + Map.entry("oslash", 'ø'), + Map.entry("ugrave", 'ù'), + Map.entry("uacute", 'ú'), + Map.entry("ucirc", 'û'), + Map.entry("uuml", 'ü'), + Map.entry("yacute", 'ý'), + Map.entry("thorn", 'þ'), + Map.entry("yuml", 'ÿ'), + // HTML40 Extended entities + Map.entry("fnof", 'ƒ'), + Map.entry("Alpha", 'Α'), + Map.entry("Beta", 'Β'), + Map.entry("Gamma", 'Γ'), + Map.entry("Delta", 'Δ'), + Map.entry("Epsilon", 'Ε'), + Map.entry("Zeta", 'Ζ'), + Map.entry("Eta", 'Η'), + Map.entry("Theta", 'Θ'), + Map.entry("Iota", 'Ι'), + Map.entry("Kappa", 'Κ'), + Map.entry("Lambda", 'Λ'), + Map.entry("Mu", 'Μ'), + Map.entry("Nu", 'Ν'), + Map.entry("Xi", 'Ξ'), + Map.entry("Omicron", 'Ο'), + Map.entry("Pi", 'Π'), + Map.entry("Rho", 'Ρ'), + Map.entry("Sigma", 'Σ'), + Map.entry("Tau", 'Τ'), + Map.entry("Upsilon", 'Υ'), + Map.entry("Phi", 'Φ'), + Map.entry("Chi", 'Χ'), + Map.entry("Psi", 'Ψ'), + Map.entry("Omega", 'Ω'), + Map.entry("alpha", 'α'), + Map.entry("beta", 'β'), + Map.entry("gamma", 'γ'), + Map.entry("delta", 'δ'), + Map.entry("epsilon", 'ε'), + Map.entry("zeta", 'ζ'), + Map.entry("eta", 'η'), + Map.entry("theta", 'θ'), + Map.entry("iota", 'ι'), + Map.entry("kappa", 'κ'), + Map.entry("lambda", 'λ'), + Map.entry("mu", 'μ'), + Map.entry("nu", 'ν'), + Map.entry("xi", 'ξ'), + Map.entry("omicron", 'ο'), + Map.entry("pi", 'π'), + Map.entry("rho", 'ρ'), + Map.entry("sigmaf", 'ς'), + Map.entry("sigma", 'σ'), + Map.entry("tau", 'τ'), + Map.entry("upsilon", 'υ'), + Map.entry("phi", 'φ'), + Map.entry("chi", 'χ'), + Map.entry("psi", 'ψ'), + Map.entry("omega", 'ω'), + Map.entry("thetasym", 'ϑ'), + Map.entry("upsih", 'ϒ'), + Map.entry("piv", 'ϖ'), + Map.entry("bull", '•'), + Map.entry("hellip", '…'), + Map.entry("prime", '′'), + Map.entry("Prime", '″'), + Map.entry("oline", '‾'), + Map.entry("frasl", '⁄'), + Map.entry("weierp", '℘'), + Map.entry("image", 'ℑ'), + Map.entry("real", 'ℜ'), + Map.entry("trade", '™'), + Map.entry("alefsym", 'ℵ'), + Map.entry("larr", '←'), + Map.entry("uarr", '↑'), + Map.entry("rarr", '→'), + Map.entry("darr", '↓'), + Map.entry("harr", '↔'), + Map.entry("crarr", '↵'), + Map.entry("lArr", '⇐'), + Map.entry("uArr", '⇑'), + Map.entry("rArr", '⇒'), + Map.entry("dArr", '⇓'), + Map.entry("hArr", '⇔'), + Map.entry("forall", '∀'), + Map.entry("part", '∂'), + Map.entry("exist", '∃'), + Map.entry("empty", '∅'), + Map.entry("nabla", '∇'), + Map.entry("isin", '∈'), + Map.entry("notin", '∉'), + Map.entry("ni", '∋'), + Map.entry("prod", '∏'), + Map.entry("sum", '∑'), + Map.entry("minus", '−'), + Map.entry("lowast", '∗'), + Map.entry("radic", '√'), + Map.entry("prop", '∝'), + Map.entry("infin", '∞'), + Map.entry("ang", '∠'), + Map.entry("and", '∧'), + Map.entry("or", '∨'), + Map.entry("cap", '∩'), + Map.entry("cup", '∪'), + Map.entry("int", '∫'), + Map.entry("there4", '∴'), + Map.entry("sim", '∼'), + Map.entry("cong", '≅'), + Map.entry("asymp", '≈'), + Map.entry("ne", '≠'), + Map.entry("equiv", '≡'), + Map.entry("le", '≤'), + Map.entry("ge", '≥'), + Map.entry("sub", '⊂'), + Map.entry("sup", '⊃'), + Map.entry("nsub", '⊄'), + Map.entry("sube", '⊆'), + Map.entry("supe", '⊇'), + Map.entry("oplus", '⊕'), + Map.entry("otimes", '⊗'), + Map.entry("perp", '⊥'), + Map.entry("sdot", '⋅'), + Map.entry("lceil", '⌈'), + Map.entry("rceil", '⌉'), + Map.entry("lfloor", '⌊'), + Map.entry("rfloor", '⌋'), + Map.entry("lang", '〈'), + Map.entry("rang", '〉'), + Map.entry("loz", '◊'), + Map.entry("spades", '♠'), + Map.entry("clubs", '♣'), + Map.entry("hearts", '♥'), + Map.entry("diams", '♦'), + Map.entry("OElig", 'Œ'), + Map.entry("oelig", 'œ'), + Map.entry("Scaron", 'Š'), + Map.entry("scaron", 'š'), + Map.entry("Yuml", 'Ÿ'), + Map.entry("circ", 'ˆ'), + Map.entry("tilde", '˜'), + Map.entry("ensp", ' '), + Map.entry("emsp", ' '), + Map.entry("thinsp", ' '), + Map.entry("zwnj", '‌'), + Map.entry("zwj", '‍'), + Map.entry("lrm", '‎'), + Map.entry("rlm", '‏'), + Map.entry("ndash", '–'), + Map.entry("mdash", '—'), + Map.entry("lsquo", '‘'), + Map.entry("rsquo", '’'), + Map.entry("sbquo", '‚'), + Map.entry("ldquo", '“'), + Map.entry("rdquo", '”'), + Map.entry("bdquo", '„'), + Map.entry("dagger", '†'), + Map.entry("Dagger", '‡'), + Map.entry("permil", '‰'), + Map.entry("lsaquo", '‹'), + Map.entry("rsaquo", '›'), + Map.entry("euro", '€'), + // XML entities + Map.entry("quot", '"'), + Map.entry("amp", '&'), + Map.entry("lt", '<'), + Map.entry("gt", '>'), + Map.entry("apos", '\'') ); /** @@ -432,8 +432,8 @@ public static String unescapeHtmlAndXMLEntities(String input) { if (entity.startsWith("#")) { try { int codePoint = entity.startsWith("#x") || entity.startsWith("#X") - ? Integer.parseInt(entity.substring(2), 16) - : Integer.parseInt(entity.substring(1)); + ? Integer.parseInt(entity.substring(2), 16) + : Integer.parseInt(entity.substring(1)); out.appendCodePoint(codePoint); // Java 11-friendly } catch (Exception e) { out.append(full); // on laisse tel quel @@ -457,6 +457,5 @@ public static String unescapeHtmlAndXMLEntities(String input) { * Private constructor to prevent instantiation of the HTMLAndXMLEscape class, * as it is only meant to provide static utility functions. */ - private HtmlAndXmlEscape() { - } -} \ No newline at end of file + private HtmlAndXmlEscape() {} +} diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java index 4c3a2993..678fdf33 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractLibException.java @@ -55,9 +55,9 @@ public MailExtractLibException() { super(); } -/* - */ -/** + /* + */ + /** * Instantiates a new extraction exception. * * @param message @@ -69,7 +69,7 @@ public MailExtractLibException(String message) { } */ -/** + /** * Instantiates a new extraction exception. * * @param cause @@ -105,8 +105,12 @@ public MailExtractLibException(String message, Throwable cause) { * @param writableStackTrace * the writable stack trace */ - public MailExtractLibException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + public MailExtractLibException( + String message, + Throwable cause, + boolean enableSuppression, + boolean writableStackTrace + ) { super(message, cause, enableSuppression, writableStackTrace); } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java index 50641ec4..08910c05 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/MailExtractProgressLogger.java @@ -87,7 +87,6 @@ public class MailExtractProgressLogger { */ @FunctionalInterface public interface ProgressLogFunc { - /** * Do progress log. * @@ -100,22 +99,22 @@ public interface ProgressLogFunc { /** * The progress log func. */ - final private ProgressLogFunc progressLogFunc; + private final ProgressLogFunc progressLogFunc; /** * The logger. */ - final private Logger logger; + private final Logger logger; /** * The number used to determine if an accumulation as to be a progress log or not. */ - final private int step; + private final int step; /** * The number of seconds expected between to "step" log publication. */ - final private int stepDuration; + private final int stepDuration; /** * The last "step" log epoch seconds. @@ -196,7 +195,13 @@ public MailExtractProgressLogger(Logger logger, int progressLogLevel, ProgressLo * @param step the step value * @param stepDuration the step duration */ - public MailExtractProgressLogger(Logger logger, int progressLogLevel, ProgressLogFunc progressConsumer, int step, int stepDuration) { + public MailExtractProgressLogger( + Logger logger, + int progressLogLevel, + ProgressLogFunc progressConsumer, + int step, + int stepDuration + ) { this.progressLogFunc = progressConsumer; this.logger = logger; this.step = step; @@ -219,8 +224,15 @@ public MailExtractProgressLogger(Logger logger, int progressLogLevel, ProgressLo * @param stepDuration the maximum time duration in seconds between progress updates * @param progressFuncLogLevel the progress log level specifically for the progress function */ - public MailExtractProgressLogger(Logger logger, int progressLogLevel, ProgressLogFunc progressConsumer, - int step, int stepDuration, int progressFuncLogLevel, int progressFuncStep) { + public MailExtractProgressLogger( + Logger logger, + int progressLogLevel, + ProgressLogFunc progressConsumer, + int step, + int stepDuration, + int progressFuncLogLevel, + int progressFuncStep + ) { this.progressLogFunc = progressConsumer; this.logger = logger; this.step = step; @@ -257,15 +269,14 @@ public boolean getDebugFlag() { * @param e the exception * @return the messages stack string */ - static public String getMessagesStackString(Throwable e) { + public static String getMessagesStackString(Throwable e) { String result; result = "-> " + e.getMessage(); - if (e.getCause() instanceof Exception) - result += "\n" + getMessagesStackString((Exception) e.getCause()); + if (e.getCause() instanceof Exception) result += "\n" + getMessagesStackString((Exception) e.getCause()); return result; } - static private String getJavaStackString(Throwable e) { + private static String getJavaStackString(Throwable e) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); e.printStackTrace(ps); @@ -278,11 +289,11 @@ static private String getJavaStackString(Throwable e) { * @param e the exception * @return the all java stack string */ - static public String getAllJavaStackString(Throwable e) { + public static String getAllJavaStackString(Throwable e) { String result; result = getJavaStackString(e); - if (e.getCause() instanceof Exception) - result += "\n------------------------------------\n" + getJavaStackString((Exception) e.getCause()); + if (e.getCause() instanceof Exception) result += + "\n------------------------------------\n" + getJavaStackString((Exception) e.getCause()); return result; } @@ -296,18 +307,21 @@ static public String getAllJavaStackString(Throwable e) { * @param log the log * @param e the exception */ - static public void doProgressLogWithoutInterruption(MailExtractProgressLogger mepl, int level, String log, Throwable e) { + public static void doProgressLogWithoutInterruption( + MailExtractProgressLogger mepl, + int level, + String log, + Throwable e + ) { if (mepl != null) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (mepl) { if (level <= mepl.progressLogLevel) { - if (e != null) - log += "\n" + getMessagesStackString(e); + if (e != null) log += "\n" + getMessagesStackString(e); if ((mepl.progressLogFunc != null) && (level <= mepl.progressFuncLogLevel)) { mepl.progressLogFunc.doProgressLog(-1, log); } - if ((e != null) && mepl.debugFlag) - log += "\n" + getAllJavaStackString(e); + if ((e != null) && mepl.debugFlag) log += "\n" + getAllJavaStackString(e); mepl.log(level, log); } } @@ -323,7 +337,7 @@ static public void doProgressLogWithoutInterruption(MailExtractProgressLogger me * @param log the log * @param e the exception */ - static public void doProgressLogIfDebug(MailExtractProgressLogger mepl, String log, Throwable e) { + public static void doProgressLogIfDebug(MailExtractProgressLogger mepl, String log, Throwable e) { if ((mepl != null) && mepl.debugFlag) { doProgressLogWithoutInterruption(mepl, GLOBAL, log, e); } @@ -340,7 +354,8 @@ static public void doProgressLogIfDebug(MailExtractProgressLogger mepl, String l * @param e the exception * @throws InterruptedException the interrupted exception */ - static public void doProgressLog(MailExtractProgressLogger mepl, int level, String log, Throwable e) throws InterruptedException { + public static void doProgressLog(MailExtractProgressLogger mepl, int level, String log, Throwable e) + throws InterruptedException { if (mepl != null) { doProgressLogWithoutInterruption(mepl, level, log, e); Thread.sleep(1); @@ -356,7 +371,8 @@ static public void doProgressLog(MailExtractProgressLogger mepl, int level, Stri * @param log the log that can contain %count key replaced by the number * @throws InterruptedException the interrupted exception */ - static public void doProgressLogOneMoreCountedObject(MailExtractProgressLogger mepl, int level, String log) throws InterruptedException { + public static void doProgressLogOneMoreCountedObject(MailExtractProgressLogger mepl, int level, String log) + throws InterruptedException { if (mepl != null) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (mepl) { @@ -365,8 +381,12 @@ static public void doProgressLogOneMoreCountedObject(MailExtractProgressLogger m int rank = mepl.counter.addAndGet(1); if (mepl.stepDuration < nowEpochSeconds - mepl.previousStepEpochSeconds) { log = log.replace("%count", Integer.toString(rank)); - if ((mepl.progressLogFunc != null) && (level <= mepl.progressFuncLogLevel)) - mepl.progressLogFunc.doProgressLog(rank, (rank % mepl.progressFuncStep == 0 ? "" : "* ") + log); + if ( + (mepl.progressLogFunc != null) && (level <= mepl.progressFuncLogLevel) + ) mepl.progressLogFunc.doProgressLog( + rank, + (rank % mepl.progressFuncStep == 0 ? "" : "* ") + log + ); mepl.log(level, log); Thread.sleep(1); mepl.previousStepEpochSeconds = nowEpochSeconds; @@ -378,8 +398,7 @@ static public void doProgressLogOneMoreCountedObject(MailExtractProgressLogger m mepl.log(level, countLog); } if ((mepl.progressLogFunc != null) && (rank % mepl.progressFuncStep) == 0) { - if (countLog == null) - countLog = log.replace("%count", Integer.toString(rank)); + if (countLog == null) countLog = log.replace("%count", Integer.toString(rank)); mepl.progressLogFunc.doProgressLog(rank, countLog); Thread.sleep(1); } @@ -395,9 +414,8 @@ static public void doProgressLogOneMoreCountedObject(MailExtractProgressLogger m * @return the string */ public static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -429,7 +447,6 @@ public String getLevelName() { return getMarker(progressLogLevel).getName(); } - /** * Gets the current progress log level. * @@ -450,14 +467,12 @@ public void setProgressLogLevel(int progressLogLevel) { private void log(int level, String message) { if (level <= progressLogLevel) { - if (logger != null) - logger.info(getMarker(level), message); + if (logger != null) logger.info(getMarker(level), message); } } /** * Close. */ - public void close() { - } + public void close() {} } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java index a0afaf48..8a9b1341 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RFC822Headers.java @@ -38,7 +38,6 @@ package fr.gouv.vitam.tools.mailextractlib.utils; import fr.gouv.vitam.tools.mailextractlib.core.StoreMessage; - import jakarta.mail.MessagingException; import jakarta.mail.internet.AddressException; import jakarta.mail.internet.InternetAddress; @@ -72,14 +71,12 @@ public class RFC822Headers extends InternetHeaders { * @return the bais */ static ByteArrayInputStream getBAIS(String headersString) { - if (headersString == null) - headersString = ""; + if (headersString == null) headersString = ""; headersString += "\n\n"; ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream(headersString.getBytes("UTF-8")); - } catch (UnsupportedEncodingException ignored) { - } + } catch (UnsupportedEncodingException ignored) {} return bais; } @@ -102,17 +99,15 @@ public RFC822Headers(String headersString, StoreMessage message) throws Messagin * @param line the line * @return the header value */ -// utility function to get the value part of an header string + // utility function to get the value part of an header string public static String getHeaderValue(String line) { int i = line.indexOf(':'); - if (i < 0) - return line; + if (i < 0) return line; // skip whitespace after ':' int j; for (j = i + 1; j < line.length(); j++) { char c = line.charAt(j); - if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) - break; + if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) break; } return line.substring(j); } @@ -128,34 +123,28 @@ public List getReferences() { if (refHeader != null) { result = new ArrayList(); String[] refList = getHeaderValue(refHeader).split(" "); - for (String tmp : refList) - try { - result.add(MimeUtility.decodeText(tmp)); - } catch (UnsupportedEncodingException ignored) { - } + for (String tmp : refList) try { + result.add(MimeUtility.decodeText(tmp)); + } catch (UnsupportedEncodingException ignored) {} } return result; } - static private String getElementalStringAddress(InternetAddress address) { + private static String getElementalStringAddress(InternetAddress address) { String result; String s; if (address != null) { s = address.getPersonal(); - if ((s != null) && !s.isEmpty()) - result = s + " "; - else - result = ""; + if ((s != null) && !s.isEmpty()) result = s + " "; + else result = ""; s = address.getAddress(); - if ((s != null) && !s.isEmpty()) - result += "<" + s + ">"; - } else - result = ""; + if ((s != null) && !s.isEmpty()) result += "<" + s + ">"; + } else result = ""; return result; } - static private String getStringAddress(InternetAddress address) { + private static String getStringAddress(InternetAddress address) { String result; if (address != null) { @@ -166,8 +155,7 @@ static private String getStringAddress(InternetAddress address) { result += ":"; InternetAddress[] group = address.getGroup(false); for (int k = 0; k < group.length; k++) { - if (k > 0) - result += ","; + if (k > 0) result += ","; result += getElementalStringAddress(group[k]); } } @@ -175,8 +163,7 @@ static private String getStringAddress(InternetAddress address) { // not supposed to be result = ""; } - } else - result = ""; + } else result = ""; return result; } @@ -194,7 +181,6 @@ public List getAddressHeader(String name) throws InterruptedException { return treatAddressHeaderString(name, message, addressHeaderString); } - /** * Processes a raw address header string and returns a list of email addresses. *

    @@ -208,7 +194,8 @@ public List getAddressHeader(String name) throws InterruptedException { * @param addressHeaderString the raw address header string to process * @return a list of processed email address strings */ - public static List treatAddressHeaderString(String name, StoreMessage message, String addressHeaderString) throws InterruptedException { + public static List treatAddressHeaderString(String name, StoreMessage message, String addressHeaderString) + throws InterruptedException { List result = new ArrayList(); if (addressHeaderString != null) { @@ -218,15 +205,19 @@ public static List treatAddressHeaderString(String name, StoreMessage me } catch (AddressException e) { // try at least to Mime decode addressHeaderString = decodeRfc2047Flexible(addressHeaderString); - message.logMessageWarning("mailextractlib.rfc822: wrongly formatted address " + addressHeaderString - + ", keep raw address list in metadata in header " + name, e); + message.logMessageWarning( + "mailextractlib.rfc822: wrongly formatted address " + + addressHeaderString + + ", keep raw address list in metadata in header " + + name, + e + ); result.add(addressHeaderString); return result; } for (InternetAddress ia : iAddressArray) { String address = getStringAddress(ia); - if (address.contains("=?")) - address = decodeRfc2047Flexible(address); + if (address.contains("=?")) address = decodeRfc2047Flexible(address); result.add(address); } } @@ -234,14 +225,10 @@ public static List treatAddressHeaderString(String name, StoreMessage me } // RFC 2047 block patterns - private static final Pattern ENCODED_WORD_PATTERN_BEGIN = Pattern.compile( - "(=\\?[^?]+\\?[BbQq]\\?[^?]+)"); - private static final Pattern ENCODED_WORD_PATTERN = Pattern.compile( - "(=\\?[^?]+\\?[BbQq]\\?[^?]+\\?=)"); - private static final Pattern Q_ENCODING_PATTERN = Pattern.compile( - "=\\?[^?]+\\?[Qq]\\?[^?]+\\?="); - private static final Pattern BASE64_BLOCK_PATTERN = Pattern.compile( - "=\\?([^?]+)\\?[Bb]\\?([^?]+)\\?="); + private static final Pattern ENCODED_WORD_PATTERN_BEGIN = Pattern.compile("(=\\?[^?]+\\?[BbQq]\\?[^?]+)"); + private static final Pattern ENCODED_WORD_PATTERN = Pattern.compile("(=\\?[^?]+\\?[BbQq]\\?[^?]+\\?=)"); + private static final Pattern Q_ENCODING_PATTERN = Pattern.compile("=\\?[^?]+\\?[Qq]\\?[^?]+\\?="); + private static final Pattern BASE64_BLOCK_PATTERN = Pattern.compile("=\\?([^?]+)\\?[Bb]\\?([^?]+)\\?="); /** * Decodes a string containing RFC 2047 encoded words, @@ -261,8 +248,7 @@ public static String decodeRfc2047Flexible(String input) { input = input.replaceAll("\\r?\\n[ \t]*", ""); // add encoded bloc end if needed - if (ENCODED_WORD_PATTERN_BEGIN.matcher(input).find() && !input.trim().endsWith("?=")) - input+="?="; + if (ENCODED_WORD_PATTERN_BEGIN.matcher(input).find() && !input.trim().endsWith("?=")) input += "?="; // Split the encoded blocs even without spaces Matcher matcher = ENCODED_WORD_PATTERN.matcher(input); @@ -302,7 +288,7 @@ public static String decodeRfc2047Flexible(String input) { } public static final Pattern SIMPLE_EMAIL_WITH_NAME_PATTERN = Pattern.compile( - "^\\s*.*?<\\s*[a-zA-Z0-9](?:[a-zA-Z0-9._%+-]{0,62}[a-zA-Z0-9])?@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\s*>\\s*$" + "^\\s*.*?<\\s*[a-zA-Z0-9](?:[a-zA-Z0-9._%+-]{0,62}[a-zA-Z0-9])?@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\s*>\\s*$" ); /** @@ -321,12 +307,12 @@ public static List removeInvalidAndDuplicatesFromAddressesList(List decodedList = new ArrayList<>(); for (String address : addressList) { - if (SIMPLE_EMAIL_WITH_NAME_PATTERN.matcher(address).matches()) - decodedList.add(address.toLowerCase().trim()); + if (SIMPLE_EMAIL_WITH_NAME_PATTERN.matcher(address).matches()) decodedList.add( + address.toLowerCase().trim() + ); } - if (decodedList.isEmpty()) - decodedList=addressList; + if (decodedList.isEmpty()) decodedList = addressList; return new ArrayList<>(new LinkedHashSet<>(decodedList)); } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java index 75996e91..4547890c 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/RawDataSource.java @@ -38,6 +38,7 @@ package fr.gouv.vitam.tools.mailextractlib.utils; import jakarta.activation.DataSource; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -69,8 +70,7 @@ public class RawDataSource implements DataSource { * the name */ public RawDataSource(byte[] rawContent, String mimeType, String name) { - if (rawContent == null) - rawContent = new byte[0]; + if (rawContent == null) rawContent = new byte[0]; inputStream = new ByteArrayInputStream(rawContent); this.mimeType = mimeType; this.name = name; @@ -129,5 +129,4 @@ public String getContentType() { public String getName() { return name; } - } diff --git a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java index c4da3b00..536bbfda 100644 --- a/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java +++ b/mailextractlib/src/main/java/fr/gouv/vitam/tools/mailextractlib/utils/package-info.java @@ -38,4 +38,4 @@ /** * Utility classes. */ -package fr.gouv.vitam.tools.mailextractlib.utils; \ No newline at end of file +package fr.gouv.vitam.tools.mailextractlib.utils; diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java index 9e005c0e..30970502 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/AllTests.java @@ -45,7 +45,6 @@ import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.BeforeAll; import org.slf4j.LoggerFactory; import java.io.File; @@ -58,11 +57,9 @@ import static org.assertj.core.api.Assertions.assertThat; public interface AllTests { - static void initializeTests(String testName) throws IOException { - File testDir=new File("target/tmpJUnit/"+testName); - if (testDir.isDirectory()) - FileUtils.deleteDirectory(testDir); + File testDir = new File("target/tmpJUnit/" + testName); + if (testDir.isDirectory()) FileUtils.deleteDirectory(testDir); StoreExtractor.initDefaultExtractors(false); } @@ -148,7 +145,6 @@ public static String removeColumnsAndSortLines(String input, int[] columnsToRemo return String.join("\n", lineList); } - /** * Removes the specified columns from each line of a given array of CSV strings. * @@ -181,7 +177,11 @@ static String[] removeColumnsFromLines(String[] lines, int[] columnsToRemove) { return result; } - static public void assertThatDirectoriesContainSameFilesWithExtensions(String expectedPath, String resultPath, String[] extensions) throws IOException { + public static void assertThatDirectoriesContainSameFilesWithExtensions( + String expectedPath, + String resultPath, + String[] extensions + ) throws IOException { // Test data: paths of directories to compare File expectedDir = new File(expectedPath); // Expected directory File actualDir = new File(resultPath); // Produced directory @@ -194,7 +194,7 @@ static public void assertThatDirectoriesContainSameFilesWithExtensions(String ex compareDirectories(expectedDir, actualDir, extensions); } - static private void compareDirectories(File dir1, File dir2, String[] extensions) throws IOException { + private static void compareDirectories(File dir1, File dir2, String[] extensions) throws IOException { // List the files in each directory File[] dir1Files = dir1.listFiles(); File[] dir2Files = dir2.listFiles(); @@ -202,42 +202,60 @@ static private void compareDirectories(File dir1, File dir2, String[] extensions // Filter with extensions if (extensions != null) { dir1Files = Arrays.stream(dir1Files) - .filter(file -> file.isDirectory() || Arrays.stream(extensions) - .anyMatch(ext -> file.getName().toLowerCase(Locale.ROOT).endsWith("." + ext.toLowerCase(Locale.ROOT)))) - .toArray(File[]::new); + .filter( + file -> + file.isDirectory() || + Arrays.stream(extensions).anyMatch( + ext -> file.getName().toLowerCase(Locale.ROOT).endsWith("." + ext.toLowerCase(Locale.ROOT)) + ) + ) + .toArray(File[]::new); dir2Files = Arrays.stream(dir2Files) - .filter(file -> file.isDirectory() || Arrays.stream(extensions) - .anyMatch(ext -> file.getName().toLowerCase(Locale.ROOT).endsWith("." + ext.toLowerCase(Locale.ROOT)))) - .toArray(File[]::new); + .filter( + file -> + file.isDirectory() || + Arrays.stream(extensions).anyMatch( + ext -> file.getName().toLowerCase(Locale.ROOT).endsWith("." + ext.toLowerCase(Locale.ROOT)) + ) + ) + .toArray(File[]::new); } // Ensure both directories are not null assertThat(dir1Files) - .as("Expected directory files (%s) have to be not null", dir1.getAbsolutePath()) - .isNotNull(); - assertThat(dir2Files) - .as("Actual directory files (%s) have to be not null", dir2.getAbsolutePath()) - .isNotNull(); + .as("Expected directory files (%s) have to be not null", dir1.getAbsolutePath()) + .isNotNull(); + assertThat(dir2Files).as("Actual directory files (%s) have to be not null", dir2.getAbsolutePath()).isNotNull(); // Sort files to ensure consistent order (avoiding dependence on file system order) - Arrays.sort(dir1Files, new Comparator() { - @Override - public int compare(File f1, File f2) { - return f1.getName().compareTo(f2.getName()); + Arrays.sort( + dir1Files, + new Comparator() { + @Override + public int compare(File f1, File f2) { + return f1.getName().compareTo(f2.getName()); + } } - }); - Arrays.sort(dir2Files, new Comparator() { - @Override - public int compare(File f1, File f2) { - return f1.getName().compareTo(f2.getName()); + ); + Arrays.sort( + dir2Files, + new Comparator() { + @Override + public int compare(File f1, File f2) { + return f1.getName().compareTo(f2.getName()); + } } - }); + ); // Verify both directories contain the same number of files assertThat(dir2Files) - .as("Directories do not contain the same number of files: %s and %s", dir1.getAbsolutePath(), dir2.getAbsolutePath()) - .hasSameSizeAs(dir1Files); + .as( + "Directories do not contain the same number of files: %s and %s", + dir1.getAbsolutePath(), + dir2.getAbsolutePath() + ) + .hasSameSizeAs(dir1Files); // Compare files one by one for (int i = 0; i < dir1Files.length; i++) { @@ -246,8 +264,8 @@ public int compare(File f1, File f2) { // Verify file names are identical assertThat(file2.getName()) - .as("File names differ at position %d: %s vs %s", i, file1.getName(), file2.getName()) - .isEqualTo(file1.getName()); + .as("File names differ at position %d: %s vs %s", i, file1.getName(), file2.getName()) + .isEqualTo(file1.getName()); if (file1.isDirectory() && file2.isDirectory()) { // Recursive comparison of sub-directories @@ -258,19 +276,31 @@ public int compare(File f1, File f2) { String content1 = FileUtils.readFileToString(file1, "UTF-8"); String content2 = FileUtils.readFileToString(file2, "UTF-8"); assertThat(content2) - .as("Content of .xml/.txt files differs: %s and %s", file1.getAbsolutePath(), file2.getAbsolutePath()) - .isEqualToNormalizingNewlines(content1); + .as( + "Content of .xml/.txt files differs: %s and %s", + file1.getAbsolutePath(), + file2.getAbsolutePath() + ) + .isEqualToNormalizingNewlines(content1); } else { byte[] content1 = Files.readAllBytes(file1.toPath()); byte[] content2 = Files.readAllBytes(file2.toPath()); assertThat(content2) - .as("Content of binary files differs: %s and %s", file1.getAbsolutePath(), file2.getAbsolutePath()) - .isEqualTo(content1); + .as( + "Content of binary files differs: %s and %s", + file1.getAbsolutePath(), + file2.getAbsolutePath() + ) + .isEqualTo(content1); } } else { // One is a file, the other is a directory (error) - throw new AssertionError("Elements do not match in directories: " + - file1.getAbsolutePath() + " and " + file2.getAbsolutePath()); + throw new AssertionError( + "Elements do not match in directories: " + + file1.getAbsolutePath() + + " and " + + file2.getAbsolutePath() + ); } } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java index a6a11696..369eae68 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestMetadata.java @@ -37,7 +37,6 @@ */ package fr.gouv.vitam.tools.mailextractlib; -import fr.gouv.vitam.tools.mailextractlib.AllTests; import fr.gouv.vitam.tools.mailextractlib.core.*; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractLibException; import fr.gouv.vitam.tools.mailextractlib.utils.MailExtractProgressLogger; @@ -57,15 +56,34 @@ public class TestMetadata implements AllTests { public void testMetadata() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testMetadata"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, false, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testMetadata"); - String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", - "src/test/resources/metadata/Test de métadonnées.eml"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testMetadata", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + false, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testMetadata"); + String urlString = StoreExtractor.composeStoreURL( + "eml", + "", + "", + "", + "src/test/resources/metadata/Test de métadonnées.eml" + ); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testMetadata", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -74,14 +92,20 @@ public void testMetadata() throws MailExtractLibException, InterruptedException, //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // metadata extraction - String metadata=FileUtils.readFileToString(new File("target/tmpJUnit/testMetadata/M#1-Test-de-méta/__ArchiveUnitMetadata.xml"),defaultCharset()); - String resultMetadata=FileUtils.readFileToString(new File("src/test/resources/metadata/results/__ArchiveUnitMetadata.xml"), StandardCharsets.UTF_8); + String metadata = FileUtils.readFileToString( + new File("target/tmpJUnit/testMetadata/M#1-Test-de-méta/__ArchiveUnitMetadata.xml"), + defaultCharset() + ); + String resultMetadata = FileUtils.readFileToString( + new File("src/test/resources/metadata/results/__ArchiveUnitMetadata.xml"), + StandardCharsets.UTF_8 + ); assertThat(metadata).isEqualToNormalizingNewlines(resultMetadata); } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java index 21a410ae..392e3ebd 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestTextExtraction.java @@ -65,6 +65,7 @@ public static void setup() { // WARNING: Deprecated in Java 17. Not recommended for production, but still good for testing. class NoExecSecurityManager extends SecurityManager { + @Override public void checkExec(String cmd) { assertNoProcessesRun.fail("Process run: '" + cmd + "'"); @@ -93,15 +94,34 @@ public static void tearDown() { public void testTextExtraction() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testTextExtraction"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - false, true, true, true, - true, 2); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + false, + true, + true, + true, + true, + 2 + ); MailExtractProgressLogger mepl = AllTests.initLogger("testTextExtraction"); - String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", - "src/test/resources/textextraction/Test text extraction.eml"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testTextExtraction", storeExtractorOptions, mepl); + String urlString = StoreExtractor.composeStoreURL( + "eml", + "", + "", + "", + "src/test/resources/textextraction/Test text extraction.eml" + ); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testTextExtraction", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -116,7 +136,10 @@ public void testTextExtraction() throws MailExtractLibException, InterruptedExce assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // compare txt and xml extracted - AllTests.assertThatDirectoriesContainSameFilesWithExtensions("src/test/resources/textextraction/results/M#1-Test-extract", - "target/tmpJUnit/testTextExtraction/M#1-Test-extract", new String[] {"txt", "xml"}); + AllTests.assertThatDirectoriesContainSameFilesWithExtensions( + "src/test/resources/textextraction/results/M#1-Test-extract", + "target/tmpJUnit/testTextExtraction/M#1-Test-extract", + new String[] { "txt", "xml" } + ); } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java index daa9154d..b6bee687 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/TestUtilities.java @@ -50,22 +50,20 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; -public class TestUtilities implements AllTests{ +public class TestUtilities implements AllTests { + @Test public void testRFC2047() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testUtilities"); - String qencoded = "Notification \n" + - "\td'=?unicode-1-1-utf-7?Q?+AOk-tat \n" + - "\tde \n" + - "\tremise \n" + - "\t(+AOk-chec)?="; - String bencoded ="=?iso-8859-1?B?Tm90aWZpY2F0aW9uIGQn6XRhdCBkZSByZW1pc2UgKOljaGVjKQ?="; - - OtherMimeCharsetProvider otm=new OtherMimeCharsetProvider(); + String qencoded = + "Notification \n" + "\td'=?unicode-1-1-utf-7?Q?+AOk-tat \n" + "\tde \n" + "\tremise \n" + "\t(+AOk-chec)?="; + String bencoded = "=?iso-8859-1?B?Tm90aWZpY2F0aW9uIGQn6XRhdCBkZSByZW1pc2UgKOljaGVjKQ?="; + + OtherMimeCharsetProvider otm = new OtherMimeCharsetProvider(); //when - String qdecoded= RFC822Headers.decodeRfc2047Flexible(qencoded); - String bdecoded= RFC822Headers.decodeRfc2047Flexible(bencoded); + String qdecoded = RFC822Headers.decodeRfc2047Flexible(qencoded); + String bdecoded = RFC822Headers.decodeRfc2047Flexible(bencoded); //then assertThat(qdecoded).isEqualTo("Notification d'état de remise (échec)"); @@ -77,69 +75,60 @@ public void testCharsets() throws MailExtractLibException, InterruptedException, //given AllTests.initializeTests("testCharsets"); - OtherMimeCharsetProvider otm=new OtherMimeCharsetProvider(); + OtherMimeCharsetProvider otm = new OtherMimeCharsetProvider(); //when/then assertThatCode(() -> { - Charset cs=Charset.forName("'us-ascii"); + Charset cs = Charset.forName("'us-ascii"); }).doesNotThrowAnyException(); assertThatCode(() -> { - Charset cs=Charset.forName("'usascii"); + Charset cs = Charset.forName("'usascii"); }).isInstanceOf(IllegalCharsetNameException.class); - } // Full HTML input string for tests private static final String HTML_INPUT = - // Named character entities - // Basic XML symbols - "<>&"'" + - - // ISO-8859-1 symbols - " ¡¢£¤¥¦§¨©ª«¬­®¯°±" + - "²³´µ¶·¸¹º»¼½¾¿" + - - // Letters with accents (Latin Extended-A) - "ÁáÉéÍíÓóÚúÝý" + - "ÀàÈèÌìÒòÙù" + - "ÂâÊêÎîÔôÛû" + - "ÄäËëÏïÖöÜüÇçÑñ" + - - // Mathematical and logical symbols - "∀∂∃∅∇∈∉∋∏∑−∗√∝∞" + - "∠∧∨∩∪∫∴∼≅≈≠≡≤≥" + - - // Arrows - "←↑→↓↔↵⇐⇑⇒⇓⇔" + - - // Greek letters - "αβγδεζηθικλμνξοπρσ" + - "τυφχψω" + - "ΓΔΘΛΞΠΣΦΨΩ" + - - // Decimal numeric equivalents - "<>&"'" + // < > & " ' - " ¡¢£¤¥¦§¨©ª«¬­®¯" + - "°±²³´µ¶·¸¹º»¼½¾¿" + - - // Hexadecimal numeric equivalents - "<>&"'" + // < > & " ' - " ¡¢£¤¥¦§¨©ª«¬­®¯" + - "°±²³´µ¶·¸¹º»¼½¾¿" + - - // Invalid entities - "&unknown;&toolongentitytobegood;¬hing"; + // Named character entities + // Basic XML symbols + "<>&"'" + + // ISO-8859-1 symbols + " ¡¢£¤¥¦§¨©ª«¬­®¯°±" + + "²³´µ¶·¸¹º»¼½¾¿" + + // Letters with accents (Latin Extended-A) + "ÁáÉéÍíÓóÚúÝý" + + "ÀàÈèÌìÒòÙù" + + "ÂâÊêÎîÔôÛû" + + "ÄäËëÏïÖöÜüÇçÑñ" + + // Mathematical and logical symbols + "∀∂∃∅∇∈∉∋∏∑−∗√∝∞" + + "∠∧∨∩∪∫∴∼≅≈≠≡≤≥" + + // Arrows + "←↑→↓↔↵⇐⇑⇒⇓⇔" + + // Greek letters + "αβγδεζηθικλμνξοπρσ" + + "τυφχψω" + + "ΓΔΘΛΞΠΣΦΨΩ" + + // Decimal numeric equivalents + "<>&"'" + // < > & " ' + " ¡¢£¤¥¦§¨©ª«¬­®¯" + + "°±²³´µ¶·¸¹º»¼½¾¿" + + // Hexadecimal numeric equivalents + "<>&"'" + // < > & " ' + " ¡¢£¤¥¦§¨©ª«¬­®¯" + + "°±²³´µ¶·¸¹º»¼½¾¿" + + // Invalid entities + "&unknown;&toolongentitytobegood;¬hing"; // Expected output string after unescaping the HTML input private static final String EXPECTED_OUTPUT = - "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + - "ÁáÉéÍíÓóÚúÝýÀàÈèÌìÒòÙùÂâÊêÎîÔôÛûÄäËëÏïÖöÜüÇçÑñ" + - "∀∂∃∅∇∈∉∋∏∑−∗√∝∞∠∧∨∩∪∫∴∼≅≈≠≡≤≥" + - "←↑→↓↔↵⇐⇑⇒⇓⇔" + - "αβγδεζηθικλμνξοπρστυφχψωΓΔΘΛΞΠΣΦΨΩ" + - "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + - "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + - "&unknown;&toolongentitytobegood;¬hing"; + "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + + "ÁáÉéÍíÓóÚúÝýÀàÈèÌìÒòÙùÂâÊêÎîÔôÛûÄäËëÏïÖöÜüÇçÑñ" + + "∀∂∃∅∇∈∉∋∏∑−∗√∝∞∠∧∨∩∪∫∴∼≅≈≠≡≤≥" + + "←↑→↓↔↵⇐⇑⇒⇓⇔" + + "αβγδεζηθικλμνξοπρστυφχψωΓΔΘΛΞΠΣΦΨΩ" + + "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + + "<>&\"' ¡¢£¤¥¦§¨©ª«¬\u00AD®¯°±²³´µ¶·¸¹º»¼½¾¿" + + "&unknown;&toolongentitytobegood;¬hing"; // Test the behavior of the unescapeHtmlAndXMLEntities method using complex HTML input @Test @@ -151,28 +140,30 @@ public void testUnescapeHtmlAndXMLEntities() { @Test public void testEscapeXML() { // Comprehensive input string - String input = "" - + "Valid text with characters & symbols.\n" // Newline + special characters - + "Control characters: \u0001\u0002\u0007\u001F should be removed,\t but not tabs or CR.\r\n" // Invalid low control characters - + "High invalid: \u0085\u0090\u009F should be removed.\n" // Invalid high control characters - + "Valid emoji: 😀 (surrogate pair: \uD83D\uDE00).\n" // Valid surrogate pair - + "Invalid surrogate: lone high \uD83D or low \uDE00.\n" // Invalid surrogates - + "Tabs\tand carriage returns\r should be preserved.\n" // Mixed whitespace - + "Nested tags: Content\n" // Nested XML-like content - + "Pre-escaped data: <already escaped> & should stay.\n" // Already escaped data - + "Quotes: 'single' and \"double\" should be escaped.\n"; // Quotes + String input = + "" + + "Valid text with characters & symbols.\n" + // Newline + special characters + "Control characters: \u0001\u0002\u0007\u001F should be removed,\t but not tabs or CR.\r\n" + // Invalid low control characters + "High invalid: \u0085\u0090\u009F should be removed.\n" + // Invalid high control characters + "Valid emoji: 😀 (surrogate pair: \uD83D\uDE00).\n" + // Valid surrogate pair + "Invalid surrogate: lone high \uD83D or low \uDE00.\n" + // Invalid surrogates + "Tabs\tand carriage returns\r should be preserved.\n" + // Mixed whitespace + "Nested tags: Content\n" + // Nested XML-like content + "Pre-escaped data: <already escaped> & should stay.\n" + // Already escaped data + "Quotes: 'single' and \"double\" should be escaped.\n"; // Quotes // Expected output string - String expectedOutput = "" - + "Valid text with <special> characters & symbols.\n" // Escaped special entities - + "Control characters: should be removed,\t but not tabs or CR.\r\n" // Invalid low control chars removed - + "High invalid: \u0085 should be removed.\n" // Invalid high control chars removed - + "Valid emoji: 😀 (surrogate pair: \uD83D\uDE00).\n" // Surrogate pairs preserved - + "Invalid surrogate: lone high or low .\n" // Lone surrogates removed - + "Tabs\tand carriage returns\r should be preserved.\n" // Tabs and carriage returns preserved - + "Nested tags: <parent><child>Content</child></parent>\n" // Nested tags escaped - + "Pre-escaped data: &lt;already escaped&gt; &amp; should stay.\n" // Already escaped are also escaped - + "Quotes: 'single' and "double" should be escaped.\n"; // Quotes escaped + String expectedOutput = + "" + + "Valid text with <special> characters & symbols.\n" + // Escaped special entities + "Control characters: should be removed,\t but not tabs or CR.\r\n" + // Invalid low control chars removed + "High invalid: \u0085 should be removed.\n" + // Invalid high control chars removed + "Valid emoji: 😀 (surrogate pair: \uD83D\uDE00).\n" + // Surrogate pairs preserved + "Invalid surrogate: lone high or low .\n" + // Lone surrogates removed + "Tabs\tand carriage returns\r should be preserved.\n" + // Tabs and carriage returns preserved + "Nested tags: <parent><child>Content</child></parent>\n" + // Nested tags escaped + "Pre-escaped data: &lt;already escaped&gt; &amp; should stay.\n" + // Already escaped are also escaped + "Quotes: 'single' and "double" should be escaped.\n"; // Quotes escaped // Execute method String result = HtmlAndXmlEscape.escapeXml(input); diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java index 14c3eb63..4aeb39e7 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestEmlStoreExtractor.java @@ -57,15 +57,34 @@ public class TestEmlStoreExtractor implements AllTests { public void testGlobalEmlExtractor() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalEmlExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalEmlExtractor"); - String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", - "src/test/resources/eml/Test message 2.eml"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalEmlExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalEmlExtractor"); + String urlString = StoreExtractor.composeStoreURL( + "eml", + "", + "", + "", + "src/test/resources/eml/Test message 2.eml" + ); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalEmlExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -74,29 +93,45 @@ public void testGlobalEmlExtractor() throws MailExtractLibException, Interrupted //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(0); // embedded mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalEmlExtractor/M#1-Test-message/M#2-Test-message/__BinaryMaster_1__-003e01d556d3-b3116ed0-19344c70-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/eml/results/embeddedMail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalEmlExtractor/M#1-Test-message/M#2-Test-message/__BinaryMaster_1__-003e01d556d3-b3116ed0-19344c70-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/eml/results/embeddedMail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); // mail eml - mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalEmlExtractor/M#1-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - resultMail=FileUtils.readFileToString(new File("src/test/resources/eml/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalEmlExtractor/M#1-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + resultMail = FileUtils.readFileToString( + new File("src/test/resources/eml/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } @@ -104,15 +139,28 @@ public void testGlobalEmlExtractor() throws MailExtractLibException, Interrupted public void testPgpEmlExtractor() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testPgpEmlExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testPgpEmlExtractor"); - String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", - "src/test/resources/eml/TestPgp.eml"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testPgpEmlExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testPgpEmlExtractor"); + String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", "src/test/resources/eml/TestPgp.eml"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testPgpEmlExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -121,18 +169,24 @@ public void testPgpEmlExtractor() throws MailExtractLibException, InterruptedExc //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testPgpEmlExtractor/M#1--membres--No/__BinaryMaster_1__-200505092127.23834.pierre.habou.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String - - resultMail=FileUtils.readFileToString(new File("src/test/resources/eml/results/pgpmail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testPgpEmlExtractor/M#1--membres--No/__BinaryMaster_1__-200505092127.23834.pierre.habou.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/eml/results/pgpmail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } @@ -140,15 +194,28 @@ public void testPgpEmlExtractor() throws MailExtractLibException, InterruptedExc public void testPkcs7EmlExtractor() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testPkcs7EmlExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testPkcs7EmlExtractor"); - String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", - "src/test/resources/eml/TestPkcs7.eml"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testPkcs7EmlExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testPkcs7EmlExtractor"); + String urlString = StoreExtractor.composeStoreURL("eml", "", "", "", "src/test/resources/eml/TestPkcs7.eml"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testPkcs7EmlExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -157,16 +224,24 @@ public void testPkcs7EmlExtractor() throws MailExtractLibException, InterruptedE //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testPkcs7EmlExtractor/M#1-Re--Présenta/__BinaryMaster_1__-53878A4F.5080807-agriculture.go.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/eml/results/pkcs7mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testPkcs7EmlExtractor/M#1-Re--Présenta/__BinaryMaster_1__-53878A4F.5080807-agriculture.go.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/eml/results/pkcs7mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java index 086367b0..04725638 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMboxStoreExtractor.java @@ -54,18 +54,32 @@ public class TestMboxStoreExtractor implements AllTests { @Test - public void testGlobalMboxExtractorSequentialTreament() throws MailExtractLibException, InterruptedException, IOException { + public void testGlobalMboxExtractorSequentialTreament() + throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalMboxExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalPstExtractor"); - String urlString = StoreExtractor.composeStoreURL("mbox", "", "", "", - "src/test/resources/mbox/Sent.mbox"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalMboxExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalPstExtractor"); + String urlString = StoreExtractor.composeStoreURL("mbox", "", "", "", "src/test/resources/mbox/Sent.mbox"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalMboxExtractor", + storeExtractorOptions, + mepl + ); storeExtractor.setMaxParallelThreads(1); //when @@ -75,44 +89,73 @@ public void testGlobalMboxExtractorSequentialTreament() throws MailExtractLibExc //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(4); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(4); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(3); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(5); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(14); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(3); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(5); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(14); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(1); // mails extraction - String mails=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMboxExtractor/messages.csv"),defaultCharset()); - mails=mails.replaceAll("/","\\\\"); - String resultMails=FileUtils.readFileToString(new File("src/test/resources/mbox/results/messages.csv"), StandardCharsets.UTF_8); - resultMails=resultMails.replaceAll("/","\\\\"); + String mails = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalMboxExtractor/messages.csv"), + defaultCharset() + ); + mails = mails.replaceAll("/", "\\\\"); + String resultMails = FileUtils.readFileToString( + new File("src/test/resources/mbox/results/messages.csv"), + StandardCharsets.UTF_8 + ); + resultMails = resultMails.replaceAll("/", "\\\\"); assertThat(mails).isEqualToNormalizingNewlines(resultMails); // mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMboxExtractor/M#4-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/mbox/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalMboxExtractor/M#4-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/mbox/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } + @Test - public void testGlobalMboxExtractorParallelTreament() throws MailExtractLibException, InterruptedException, IOException { + public void testGlobalMboxExtractorParallelTreament() + throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalMboxExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalPstExtractor"); - String urlString = StoreExtractor.composeStoreURL("mbox", "", "", "", - "src/test/resources/mbox/Sent.mbox"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalMboxExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalPstExtractor"); + String urlString = StoreExtractor.composeStoreURL("mbox", "", "", "", "src/test/resources/mbox/Sent.mbox"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalMboxExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -121,37 +164,52 @@ public void testGlobalMboxExtractorParallelTreament() throws MailExtractLibExcep //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(4); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(4); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(3); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(5); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(14); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(3); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(5); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(14); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(1); // mails extraction - String mails=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMboxExtractor/messages.csv"),defaultCharset()); - mails=AllTests.removeColumnsAndSortLines(mails.replaceAll("/","\\\\"), new int[]{1}); - String resultMails=FileUtils.readFileToString(new File("src/test/resources/mbox/results/messages.csv"), StandardCharsets.UTF_8); - resultMails=AllTests.removeColumnsAndSortLines(resultMails.replaceAll("/","\\\\"), new int[]{1}); + String mails = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalMboxExtractor/messages.csv"), + defaultCharset() + ); + mails = AllTests.removeColumnsAndSortLines(mails.replaceAll("/", "\\\\"), new int[] { 1 }); + String resultMails = FileUtils.readFileToString( + new File("src/test/resources/mbox/results/messages.csv"), + StandardCharsets.UTF_8 + ); + resultMails = AllTests.removeColumnsAndSortLines(resultMails.replaceAll("/", "\\\\"), new int[] { 1 }); assertThat(mails).isEqualToNormalizingNewlines(resultMails); // mail eml - String mail=null; - for (int i=1;i<=12;i++) { + String mail = null; + for (int i = 1; i <= 12; i++) { try { - mail = FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMboxExtractor/M#"+i+"-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"),defaultCharset()); + mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalMboxExtractor/M#" + + i + + "-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); break; - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } assertThat(mail).isNotNull(); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/mbox/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/mbox/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java index 931f6f22..4ad3edfc 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestMsgStoreExtractor.java @@ -57,15 +57,34 @@ public class TestMsgStoreExtractor implements AllTests { public void testGlobalMsgExtractor() throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalMsgExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalMsgExtractor"); - String urlString = StoreExtractor.composeStoreURL("msg", "", "", "", - "src/test/resources/msg/Test message 2.msg"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalMsgExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalMsgExtractor"); + String urlString = StoreExtractor.composeStoreURL( + "msg", + "", + "", + "", + "src/test/resources/msg/Test message 2.msg" + ); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalMsgExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -74,29 +93,45 @@ public void testGlobalMsgExtractor() throws MailExtractLibException, Interrupted //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(0); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(1); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(0); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(0); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(0); // embedded mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMsgExtractor/M#1-Test-message/M#2-Test-message/__BinaryMaster_1__-003e01d556d3-b3116ed0-19344c70-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/msg/results/embeddedMail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalMsgExtractor/M#1-Test-message/M#2-Test-message/__BinaryMaster_1__-003e01d556d3-b3116ed0-19344c70-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/msg/results/embeddedMail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); // mail eml - mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalMsgExtractor/M#1-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - resultMail=FileUtils.readFileToString(new File("src/test/resources/msg/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalMsgExtractor/M#1-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + resultMail = FileUtils.readFileToString( + new File("src/test/resources/msg/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } } diff --git a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java index bd432278..b9db27c4 100644 --- a/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java +++ b/mailextractlib/src/test/java/fr/gouv/vitam/tools/mailextractlib/store/TestPstStoreExtractor.java @@ -54,18 +54,32 @@ public class TestPstStoreExtractor implements AllTests { @Test - public void testGlobalPstExtractorSequentialTreament() throws MailExtractLibException, InterruptedException, IOException { + public void testGlobalPstExtractorSequentialTreament() + throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalPstExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalPstExtractor"); - String urlString = StoreExtractor.composeStoreURL("pst", "", "", "", - "src/test/resources/pst/Test.pst"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalPstExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalPstExtractor"); + String urlString = StoreExtractor.composeStoreURL("pst", "", "", "", "src/test/resources/pst/Test.pst"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalPstExtractor", + storeExtractorOptions, + mepl + ); storeExtractor.setMaxParallelThreads(1); //when @@ -75,58 +89,102 @@ public void testGlobalPstExtractorSequentialTreament() throws MailExtractLibExce //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(4); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(5); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(25); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(4); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(5); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(25); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(1); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(7); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(14); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(28); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(2); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(7); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(14); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(28); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(2); // mails extraction comparison - String mails=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/messages.csv"),defaultCharset()); - mails=mails.replaceAll("/","\\\\"); - String resultMails=FileUtils.readFileToString(new File("src/test/resources/pst/results/messages.csv"), StandardCharsets.UTF_8); - resultMails=resultMails.replaceAll("/","\\\\"); + String mails = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalPstExtractor/messages.csv"), + defaultCharset() + ); + mails = mails.replaceAll("/", "\\\\"); + String resultMails = FileUtils.readFileToString( + new File("src/test/resources/pst/results/messages.csv"), + StandardCharsets.UTF_8 + ); + resultMails = resultMails.replaceAll("/", "\\\\"); assertThat(mails).isEqualToNormalizingNewlines(resultMails); // appointments extraction comparison except UniqID and ExceptionToID which may differ in parallel treatment - String appointments=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/appointments.csv"),defaultCharset()); - appointments=AllTests.removeColumnsAndSortLines(appointments.replaceAll("/","\\\\"), new int[]{10,19}); - String resultAppointments=FileUtils.readFileToString(new File("src/test/resources/pst/results/appointments.csv"), StandardCharsets.UTF_8); - resultAppointments=AllTests.removeColumnsAndSortLines(resultAppointments.replaceAll("/","\\\\"), new int[]{10,19}); + String appointments = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalPstExtractor/appointments.csv"), + defaultCharset() + ); + appointments = AllTests.removeColumnsAndSortLines(appointments.replaceAll("/", "\\\\"), new int[] { 10, 19 }); + String resultAppointments = FileUtils.readFileToString( + new File("src/test/resources/pst/results/appointments.csv"), + StandardCharsets.UTF_8 + ); + resultAppointments = AllTests.removeColumnsAndSortLines( + resultAppointments.replaceAll("/", "\\\\"), + new int[] { 10, 19 } + ); assertThat(appointments).isEqualToNormalizingNewlines(resultAppointments); // contacts extraction - assertThat(new File("target/tmpJUnit/testGlobalPstExtractor/contacts.csv")). - hasSameContentAs(new File("src/test/resources/pst/results/contacts.csv"),StandardCharsets.UTF_8); - assertThat(new File("target/tmpJUnit/testGlobalPstExtractor/contacts/ContactPicture#1/__BinaryMaster_1__ContactPicture.jpg")). - hasBinaryContent(FileUtils.readFileToByteArray(new File("src/test/resources/pst/results/ContactPicture.jpg"))); + assertThat(new File("target/tmpJUnit/testGlobalPstExtractor/contacts.csv")).hasSameContentAs( + new File("src/test/resources/pst/results/contacts.csv"), + StandardCharsets.UTF_8 + ); + assertThat( + new File( + "target/tmpJUnit/testGlobalPstExtractor/contacts/ContactPicture#1/__BinaryMaster_1__ContactPicture.jpg" + ) + ).hasBinaryContent( + FileUtils.readFileToByteArray(new File("src/test/resources/pst/results/ContactPicture.jpg")) + ); // mail eml - String mail=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/F#1-Début-du-fic/F#54-Éléments-env/M#58-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"),defaultCharset()); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/pst/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + String mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalPstExtractor/F#1-Début-du-fic/F#54-Éléments-env/M#58-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/pst/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } @Test - public void testGlobalPstExtractorParallelTreament() throws MailExtractLibException, InterruptedException, IOException { + public void testGlobalPstExtractorParallelTreament() + throws MailExtractLibException, InterruptedException, IOException { //given AllTests.initializeTests("testGlobalPstExtractor"); - StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions(false, - true, true, 12, "windows-1252", - true, true, true, true, - true,2); - MailExtractProgressLogger mepl= AllTests.initLogger("testGlobalPstExtractor"); - String urlString = StoreExtractor.composeStoreURL("pst", "", "", "", - "src/test/resources/pst/Test.pst"); - StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor(urlString, "", - "target/tmpJUnit/testGlobalPstExtractor", storeExtractorOptions, mepl); + StoreExtractorOptions storeExtractorOptions = new StoreExtractorOptions( + false, + true, + true, + 12, + "windows-1252", + true, + true, + true, + true, + true, + 2 + ); + MailExtractProgressLogger mepl = AllTests.initLogger("testGlobalPstExtractor"); + String urlString = StoreExtractor.composeStoreURL("pst", "", "", "", "src/test/resources/pst/Test.pst"); + StoreExtractor storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + "", + "target/tmpJUnit/testGlobalPstExtractor", + storeExtractorOptions, + mepl + ); //when storeExtractor.extractAllFolders(); @@ -135,53 +193,90 @@ public void testGlobalPstExtractorParallelTreament() throws MailExtractLibExcept //then // element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,false)).isEqualTo(4); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,false)).isEqualTo(5); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,false)).isEqualTo(25); - assertThat(storeExtractor.getElementCounter(StoreContact.class,false)).isEqualTo(1); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, false)).isEqualTo(4); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, false)).isEqualTo(5); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, false)).isEqualTo(25); + assertThat(storeExtractor.getElementCounter(StoreContact.class, false)).isEqualTo(1); // sub element counters - assertThat(storeExtractor.getElementCounter(StoreFolder.class,true)).isEqualTo(7); - assertThat(storeExtractor.getElementCounter(StoreMessage.class,true)).isEqualTo(14); - assertThat(storeExtractor.getElementCounter(StoreAppointment.class,true)).isEqualTo(28); - assertThat(storeExtractor.getElementCounter(StoreContact.class,true)).isEqualTo(2); + assertThat(storeExtractor.getElementCounter(StoreFolder.class, true)).isEqualTo(7); + assertThat(storeExtractor.getElementCounter(StoreMessage.class, true)).isEqualTo(14); + assertThat(storeExtractor.getElementCounter(StoreAppointment.class, true)).isEqualTo(28); + assertThat(storeExtractor.getElementCounter(StoreContact.class, true)).isEqualTo(2); // mails extraction comparison except ID which may differ in parallel treatment - String mails=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/messages.csv"),defaultCharset()); - mails=AllTests.removeColumnsAndSortLines(mails.replaceAll("/","\\\\"), new int[]{1}); - String resultMails=FileUtils.readFileToString(new File("src/test/resources/pst/results/messages.csv"), StandardCharsets.UTF_8); - resultMails=AllTests.removeColumnsAndSortLines(resultMails.replaceAll("/","\\\\"), new int[]{1}); + String mails = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalPstExtractor/messages.csv"), + defaultCharset() + ); + mails = AllTests.removeColumnsAndSortLines(mails.replaceAll("/", "\\\\"), new int[] { 1 }); + String resultMails = FileUtils.readFileToString( + new File("src/test/resources/pst/results/messages.csv"), + StandardCharsets.UTF_8 + ); + resultMails = AllTests.removeColumnsAndSortLines(resultMails.replaceAll("/", "\\\\"), new int[] { 1 }); assertThat(mails).isEqualToNormalizingNewlines(resultMails); // appointments extraction comparison except ID, UniqID and ExceptionToID which may differ in parallel treatment - String appointments=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/appointments.csv"),defaultCharset()); - appointments=AllTests.removeColumnsAndSortLines(appointments.replaceAll("/","\\\\"), new int[]{1,10,19}); - String resultAppointments=FileUtils.readFileToString(new File("src/test/resources/pst/results/appointments.csv"), StandardCharsets.UTF_8); - resultAppointments=AllTests.removeColumnsAndSortLines(resultAppointments.replaceAll("/","\\\\"), new int[]{1,10,19}); + String appointments = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalPstExtractor/appointments.csv"), + defaultCharset() + ); + appointments = AllTests.removeColumnsAndSortLines( + appointments.replaceAll("/", "\\\\"), + new int[] { 1, 10, 19 } + ); + String resultAppointments = FileUtils.readFileToString( + new File("src/test/resources/pst/results/appointments.csv"), + StandardCharsets.UTF_8 + ); + resultAppointments = AllTests.removeColumnsAndSortLines( + resultAppointments.replaceAll("/", "\\\\"), + new int[] { 1, 10, 19 } + ); assertThat(appointments).isEqualToNormalizingNewlines(resultAppointments); // contacts extraction - String contacts=FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/contacts.csv"),defaultCharset()); - String resultContacts=FileUtils.readFileToString(new File("src/test/resources/pst/results/contacts.csv"), StandardCharsets.UTF_8); + String contacts = FileUtils.readFileToString( + new File("target/tmpJUnit/testGlobalPstExtractor/contacts.csv"), + defaultCharset() + ); + String resultContacts = FileUtils.readFileToString( + new File("src/test/resources/pst/results/contacts.csv"), + StandardCharsets.UTF_8 + ); assertThat(contacts).isEqualToNormalizingNewlines(resultContacts); - assertThat(new File("target/tmpJUnit/testGlobalPstExtractor/contacts/ContactPicture#1/__BinaryMaster_1__ContactPicture.jpg")). - hasBinaryContent(FileUtils.readFileToByteArray(new File("src/test/resources/pst/results/ContactPicture.jpg"))); + assertThat( + new File( + "target/tmpJUnit/testGlobalPstExtractor/contacts/ContactPicture#1/__BinaryMaster_1__ContactPicture.jpg" + ) + ).hasBinaryContent( + FileUtils.readFileToByteArray(new File("src/test/resources/pst/results/ContactPicture.jpg")) + ); // mail eml (first search for the good file name as the number is not predictable in parallel treatment) - String mail=null; - for (int i=55;i<=62;i++) { + String mail = null; + for (int i = 55; i <= 62; i++) { try { - mail = FileUtils.readFileToString(new File("target/tmpJUnit/testGlobalPstExtractor/F#1-Début-du-fic/F#54-Éléments-env/M#"+i+"-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml"), defaultCharset()); + mail = FileUtils.readFileToString( + new File( + "target/tmpJUnit/testGlobalPstExtractor/F#1-Début-du-fic/F#54-Éléments-env/M#" + + i + + "-Test-message/__BinaryMaster_1__-000c01d556d5-611cfc50-2356f4f0-.eml" + ), + defaultCharset() + ); break; - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } assertThat(mail).isNotNull(); - mail=mail.replaceAll("----=_Part.*",""); - String resultMail=FileUtils.readFileToString(new File("src/test/resources/pst/results/mail.eml"), StandardCharsets.UTF_8); - resultMail=resultMail.replaceAll("----=_Part.*",""); + mail = mail.replaceAll("----=_Part.*", ""); + String resultMail = FileUtils.readFileToString( + new File("src/test/resources/pst/results/mail.eml"), + StandardCharsets.UTF_8 + ); + resultMail = resultMail.replaceAll("----=_Part.*", ""); assertThat(mail).isEqualToNormalizingNewlines(resultMail); } - } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java index 525d14fd..f5fd3e8d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipApp.java @@ -168,63 +168,104 @@ private static Options createOptions() { Option help = new Option("h", "help", false, "help"); options.addOption(help); - Option diskimport = new Option("d", "diskimport", true, + Option diskimport = new Option( + "d", + "diskimport", + true, "importe une hiérarchie d'AU depuis une hiérarchie de répertoires et fichiers avec en " + - "argument le répertoire racine"); + "argument le répertoire racine" + ); options.addOption(diskimport); - Option exclude = new Option("e", "exclude", true, "de l'import par diskimport les fichiers" + - " les fichiers dont le nom sont conformes aux expressions régulières contenue sur chaque ligne du fichier"); + Option exclude = new Option( + "e", + "exclude", + true, + "de l'import par diskimport les fichiers" + + " les fichiers dont le nom sont conformes aux expressions régulières contenue sur chaque ligne du fichier" + ); options.addOption(exclude); - Option listimport = new Option("l", "listimport", true, + Option listimport = new Option( + "l", + "listimport", + true, "importe une hiérarchie d'AU depuis un ensemble de répertoires et de fichiers dont " + - "la hiérarchie et les métadonnées sont décrits dans un csv"); + "la hiérarchie et les métadonnées sont décrits dans un csv" + ); options.addOption(listimport); - Option sipimport = new Option("s", "sipimport", true, - "importe une hiérarchie d'AU depuis un SIP SEDA avec en argument le nom du fichier"); + Option sipimport = new Option( + "s", + "sipimport", + true, + "importe une hiérarchie d'AU depuis un SIP SEDA avec en argument le nom du fichier" + ); options.addOption(sipimport); - Option context = new Option("c", "context", true, - "défini les informations globales utiles à la génération du SIP (MessageIdentifier...) dans le fichier indiqué"); + Option context = new Option( + "c", + "context", + true, + "défini les informations globales utiles à la génération du SIP (MessageIdentifier...) dans le fichier indiqué" + ); options.addOption(context); - Option generatesip = new Option("g", "generatesip", true, - "génère un paquet SEDA SIP de la structure importée avec en argument le nom du fichier à " + - "générer"); + Option generatesip = new Option( + "g", + "generatesip", + true, + "génère un paquet SEDA SIP de la structure importée avec en argument le nom du fichier à " + "générer" + ); options.addOption(generatesip); - Option manifest = new Option("m", "manifest", true, - "génère le manifest SEDA de la structure importée avec en argument le nom du fichier à " + - "générer"); + Option manifest = new Option( + "m", + "manifest", + true, + "génère le manifest SEDA de la structure importée avec en argument le nom du fichier à " + "générer" + ); options.addOption(manifest); - Option nolink = new Option("n", "nolink", false, - "indique qu'il faut ignorer les liens symboliques et raccourcis"); + Option nolink = new Option( + "n", + "nolink", + false, + "indique qu'il faut ignorer les liens symboliques et raccourcis" + ); options.addOption(nolink); - Option workdir = new Option("w", "workdir", true, - "désigne le répertoire de travail pour les logs, les répertoires d'extraction temporaire"); + Option workdir = new Option( + "w", + "workdir", + true, + "désigne le répertoire de travail pour les logs, les répertoires d'extraction temporaire" + ); options.addOption(workdir); - Option command = new Option("x", "xcommand", false, "ne lance pas l'interface " + - "graphique"); + Option command = new Option("x", "xcommand", false, "ne lance pas l'interface " + "graphique"); options.addOption(command); - Option hierarchical = new Option("h", "hierarchical", false, - "génère les ArchiveUnits en mode hiérarchique dans le manifest SEDA"); + Option hierarchical = new Option( + "h", + "hierarchical", + false, + "génère les ArchiveUnits en mode hiérarchique dans le manifest SEDA" + ); options.addOption(hierarchical); Option indented = new Option("i", "indented", false, "génère le manifest SEDA en XML indenté"); options.addOption(indented); - Option verbatim = new Option("v", "verbatim", true, - "niveau de log (OFF|ERROR|GLOBAL|STEP|OBJECTS_GROUP|OBJECTS|OBJECTS_WARNINGS)"); + Option verbatim = new Option( + "v", + "verbatim", + true, + "niveau de log (OFF|ERROR|GLOBAL|STEP|OBJECTS_GROUP|OBJECTS|OBJECTS_WARNINGS)" + ); options.addOption(verbatim); - Option sedaversion = new Option("V", "sedaversion", true, - "sous-version du SEDA 2 (1|2), à 1 par défaut"); + Option sedaversion = new Option("V", "sedaversion", true, "sous-version du SEDA 2 (1|2), à 1 par défaut"); options.addOption(sedaversion); return options; @@ -245,9 +286,7 @@ private static String[] importStringArray(String filename) throws IOException { * @param args the arguments * @throws ResipException the resip exception */ - public static void main(String[] args) throws - ResipException { - + public static void main(String[] args) throws ResipException { System.out.println("Resip launched"); EventBus.subscribe(SedaVersionChangedEvent.class, event -> SedaContext.setVersion(event.getNewVersion())); @@ -279,34 +318,44 @@ public static void main(String[] args) throws List inputDirList = cmd.getArgList(); if (!inputDirList.isEmpty()) { System.err.print("Resip: Exécution annulée, arguments non reconnus ["); - for (String arg : inputDirList) - System.err.print(arg + " "); + for (String arg : inputDirList) System.err.print(arg + " "); System.err.println("]"); System.exit(1); } - if ((cmd.hasOption("sipimport") ? 1 : 0) + (cmd.hasOption("diskimport") ? 1 : 0) + - (cmd.hasOption("listimport") ? 1 : 0) > 1) { + if ( + (cmd.hasOption("sipimport") ? 1 : 0) + + (cmd.hasOption("diskimport") ? 1 : 0) + + (cmd.hasOption("listimport") ? 1 : 0) > + 1 + ) { System.err.println("Resip: Ne peux pas importer selon deux modes en même temps"); System.exit(1); } - if (cmd.hasOption("generatesip") && !cmd.hasOption("diskimport") && - !cmd.hasOption("listimport") && !cmd.hasOption("sipimport")) { + if ( + cmd.hasOption("generatesip") && + !cmd.hasOption("diskimport") && + !cmd.hasOption("listimport") && + !cmd.hasOption("sipimport") + ) { System.err.println( - "Resip: Ne peux pas générer un SIP sans avoir importé une structure archiveUnit préalable"); + "Resip: Ne peux pas générer un SIP sans avoir importé une structure archiveUnit préalable" + ); System.exit(1); } if (cmd.hasOption("generatesip") && !cmd.hasOption("xcommand")) { System.err.println( - "Resip: Ne peux pas générer en mode graphique, seulement en mode command (option --xcommand)"); + "Resip: Ne peux pas générer en mode graphique, seulement en mode command (option --xcommand)" + ); System.exit(1); } if (cmd.hasOption("context") && !cmd.hasOption("xcommand")) { System.err.println( - "Resip: Ne prend en compte un fichier de contexte qu'en mode command (option --xcommand)"); + "Resip: Ne prend en compte un fichier de contexte qu'en mode command (option --xcommand)" + ); System.exit(1); } @@ -330,22 +379,24 @@ public static void main(String[] args) throws try { Files.createDirectories(Paths.get(workdirString)); } catch (Exception e) { - System.err - .println("Resip: La création de l'arborescence en --workdir n'est pas possible\n->" + e.getMessage()); + System.err.println( + "Resip: La création de l'arborescence en --workdir n'est pas possible\n->" + e.getMessage() + ); System.exit(1); } // define loglevel logLevel = -1; - if (cmd.getOptionValue("verbatim") == null) - logLevel = ResipLogger.GLOBAL; + if (cmd.getOptionValue("verbatim") == null) logLevel = ResipLogger.GLOBAL; else { try { logLevel = ResipLogger.getLevel(cmd.getOptionValue("verbatim")); } catch (Exception e) { System.err.println( "Resip: L'argument de niveau de log est non conforme, il doit être dans la liste " + - "(OFF|ERROR|GLOBAL|STEP|OBJECTS_GROUP|OBJECTS|OBJECTS_WARNINGS)\n->" + e.getMessage()); + "(OFF|ERROR|GLOBAL|STEP|OBJECTS_GROUP|OBJECTS|OBJECTS_WARNINGS)\n->" + + e.getMessage() + ); System.exit(1); } } @@ -371,8 +422,13 @@ public static void main(String[] args) throws // define the global logger ResipLogger.createGlobalLogger(workdirString + File.separator + "log.txt", logLevel); - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, "Début du journal au niveau=" + - ResipLogger.getMarker(ResipLogger.getGlobalLogger().getProgressLogLevel()).getName(), null); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.GLOBAL, + "Début du journal au niveau=" + + ResipLogger.getMarker(ResipLogger.getGlobalLogger().getProgressLogLevel()).getName(), + null + ); // define the convenient import context if (cmd.hasOption("diskimport")) { @@ -383,24 +439,34 @@ public static void main(String[] args) throws } catch (Exception e) { System.err.println( "Resip: Impossible de charger le fichier de configuration des exclusions d'import" + - " [" + cmd.getOptionValue("context") + "]\n->" + e.getMessage()); + " [" + + cmd.getOptionValue("context") + + "]\n->" + + e.getMessage() + ); System.exit(1); } } - creationContext = - new DiskImportContext(Arrays.asList(excludePatterns), false, cmd.getOptionValue("diskimport"), - workdirString); - } else if (cmd.hasOption("sipimport")) - creationContext = new SIPImportContext(cmd.getOptionValue("sipimport"), workdirString); + creationContext = new DiskImportContext( + Arrays.asList(excludePatterns), + false, + cmd.getOptionValue("diskimport"), + workdirString + ); + } else if (cmd.hasOption("sipimport")) creationContext = new SIPImportContext( + cmd.getOptionValue("sipimport"), + workdirString + ); else if (cmd.hasOption("listimport")) { - if (System.getProperty("os.name").toLowerCase().contains("win")) - creationContext = - new CSVMetadataImportContext("windows-1252", ';', cmd.getOptionValue("listimport"), workdirString); - else - creationContext = - new CSVMetadataImportContext("UTF-8", ';', cmd.getOptionValue("listimport"), workdirString); - } else - creationContext = null; + if (System.getProperty("os.name").toLowerCase().contains("win")) creationContext = + new CSVMetadataImportContext("windows-1252", ';', cmd.getOptionValue("listimport"), workdirString); + else creationContext = new CSVMetadataImportContext( + "UTF-8", + ';', + cmd.getOptionValue("listimport"), + workdirString + ); + } else creationContext = null; // define export context if (cmd.hasOption("context")) { @@ -409,7 +475,11 @@ else if (cmd.hasOption("listimport")) { } catch (Exception e) { System.err.println( "Resip: Impossible de charger le fichier de configuration informations globales utiles à la " + - "génération du SIP [" + cmd.getOptionValue("context") + "]\n->" + e.getMessage()); + "génération du SIP [" + + cmd.getOptionValue("context") + + "]\n->" + + e.getMessage() + ); System.exit(1); return; } @@ -426,70 +496,91 @@ else if (cmd.hasOption("listimport")) { if (!cmd.hasOption("xcommand")) { new ResipGraphicApp(creationContext); } else { - try { DroidIdentifier.getInstance(); ArchiveTransfer packet = null; Instant start, end; start = Instant.now(); - SEDALibProgressLogger spl = - new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), logLevel); + SEDALibProgressLogger spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + logLevel + ); if (creationContext instanceof DiskImportContext) { DiskImportContext diskImportContext = (DiskImportContext) creationContext; - DiskToArchiveTransferImporter di = - new DiskToArchiveTransferImporter(diskImportContext.getOnDiskInput(), spl); - for (String ip : diskImportContext.getIgnorePatternList()) - di.addIgnorePattern(ip); + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + diskImportContext.getOnDiskInput(), + spl + ); + for (String ip : diskImportContext.getIgnorePatternList()) di.addIgnorePattern(ip); di.doImport(); packet = di.getArchiveTransfer(); - } else //noinspection ConstantConditions - if (creationContext instanceof SIPImportContext) { - SIPImportContext sipImportContext = (SIPImportContext) creationContext; - String target = sipImportContext.getWorkDir() + File.separator + - Paths.get(sipImportContext.getOnDiskInput()).getFileName().toString() + "-tmpdir"; - SIPToArchiveTransferImporter si = - new SIPToArchiveTransferImporter(sipImportContext.getOnDiskInput(), target, spl); - si.doImport(); - packet = si.getArchiveTransfer(); - } else if (creationContext instanceof CSVImportContext) { - CSVMetadataImportContext cSVMetadataImportContext = (CSVMetadataImportContext) creationContext; - CSVMetadataToDataObjectPackageImporter cmi = new CSVMetadataToDataObjectPackageImporter( - cSVMetadataImportContext.getOnDiskInput(), cSVMetadataImportContext.getCsvCharsetName(), - cSVMetadataImportContext.getDelimiter(), spl); - cmi.doImport(); - - packet = new ArchiveTransfer(); - Work work = new Work(cmi.getDataObjectPackage(), cSVMetadataImportContext, exportContext); - work.getDataObjectPackage() - .setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); - packet.setDataObjectPackage(work.getDataObjectPackage()); - packet.setGlobalMetadata(work.getExportContext().getArchiveTransferGlobalMetadata()); - } + } else if (creationContext instanceof SIPImportContext) { //noinspection ConstantConditions + SIPImportContext sipImportContext = (SIPImportContext) creationContext; + String target = + sipImportContext.getWorkDir() + + File.separator + + Paths.get(sipImportContext.getOnDiskInput()).getFileName().toString() + + "-tmpdir"; + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + sipImportContext.getOnDiskInput(), + target, + spl + ); + si.doImport(); + packet = si.getArchiveTransfer(); + } else if (creationContext instanceof CSVImportContext) { + CSVMetadataImportContext cSVMetadataImportContext = (CSVMetadataImportContext) creationContext; + CSVMetadataToDataObjectPackageImporter cmi = new CSVMetadataToDataObjectPackageImporter( + cSVMetadataImportContext.getOnDiskInput(), + cSVMetadataImportContext.getCsvCharsetName(), + cSVMetadataImportContext.getDelimiter(), + spl + ); + cmi.doImport(); + + packet = new ArchiveTransfer(); + Work work = new Work(cmi.getDataObjectPackage(), cSVMetadataImportContext, exportContext); + work + .getDataObjectPackage() + .setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); + packet.setDataObjectPackage(work.getDataObjectPackage()); + packet.setGlobalMetadata(work.getExportContext().getArchiveTransferGlobalMetadata()); + } if (((cmd.hasOption("generatesip")) || (cmd.hasOption("manifest"))) && (packet != null)) { - if (packet.getGlobalMetadata() == null) - packet.setGlobalMetadata(exportContext.getArchiveTransferGlobalMetadata()); - if (packet.getDataObjectPackage().getManagementMetadataXmlData() == null) - packet.getDataObjectPackage() - .setManagementMetadataXmlData(exportContext.getManagementMetadataXmlData()); + if (packet.getGlobalMetadata() == null) packet.setGlobalMetadata( + exportContext.getArchiveTransferGlobalMetadata() + ); + if (packet.getDataObjectPackage().getManagementMetadataXmlData() == null) packet + .getDataObjectPackage() + .setManagementMetadataXmlData(exportContext.getManagementMetadataXmlData()); ArchiveTransferToSIPExporter se = new ArchiveTransferToSIPExporter(packet, spl); if (cmd.hasOption("generatesip")) { - se.doExportToSEDASIP(cmd.getOptionValue("generatesip"), cmd.hasOption("hierarchical"), - cmd.hasOption("indented")); + se.doExportToSEDASIP( + cmd.getOptionValue("generatesip"), + cmd.hasOption("hierarchical"), + cmd.hasOption("indented") + ); } else if (cmd.hasOption("manifest")) { - se.doExportToSEDAXMLManifest(cmd.getOptionValue("manifest"), cmd.hasOption("hierarchical"), - cmd.hasOption("indented")); + se.doExportToSEDAXMLManifest( + cmd.getOptionValue("manifest"), + cmd.hasOption("hierarchical"), + cmd.hasOption("indented") + ); } } end = Instant.now(); - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, - " Toutes les opérations finies en =" + Duration.between(start, end).toString(), null); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.GLOBAL, + " Toutes les opérations finies en =" + Duration.between(start, end).toString(), + null + ); } catch (Exception e) { - System.err.println( - "Resip: Erreur fatale\n" + SEDALibProgressLogger.getMessagesStackString(e)); + System.err.println("Resip: Erreur fatale\n" + SEDALibProgressLogger.getMessagesStackString(e)); e.printStackTrace(); System.exit(1); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java index e3284884..562e8677 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/ResipGraphicApp.java @@ -55,7 +55,6 @@ import fr.gouv.vitam.tools.resip.threads.ImportThread; import fr.gouv.vitam.tools.resip.utils.ResipException; import fr.gouv.vitam.tools.resip.utils.ResipLogger; -import fr.gouv.vitam.tools.sedalib.core.seda.SedaContext; import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; import fr.gouv.vitam.tools.sedalib.droid.DroidIdentifier; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; @@ -94,13 +93,13 @@ public class ResipGraphicApp implements ActionListener, Runnable { /** * The constant theApp. */ -// Uniq instance. */ + // Uniq instance. */ private static ResipGraphicApp theApp = null; /** * The Launch creation context. */ -// Data elements. */ + // Data elements. */ public CreationContext launchCreationContext; /** * The Current work. @@ -126,7 +125,7 @@ public class ResipGraphicApp implements ActionListener, Runnable { /** * The Main window. */ -// GUI elements. */ + // GUI elements. */ public static MainWindow mainWindow; // MainWindow menu elements dis/enabled depending on work state and used by controller. */ @@ -139,7 +138,7 @@ public class ResipGraphicApp implements ActionListener, Runnable { /** * The Import thread running. */ -// Thread control elements. */ + // Thread control elements. */ public boolean importThreadRunning; /** * The Add thread running. @@ -153,7 +152,7 @@ public class ResipGraphicApp implements ActionListener, Runnable { /** * The Search dialog. */ -// Dialogs elements. */ + // Dialogs elements. */ public SearchDialog searchDialog; /** * The Technical search dialog. @@ -181,25 +180,22 @@ public class ResipGraphicApp implements ActionListener, Runnable { * @throws ResipException the resip exception */ public ResipGraphicApp(CreationContext creationContext) throws ResipException { - EventBus.subscribe( - SedaVersionChangedEvent.class, - event -> this.sedaVersion = event.getNewVersion() - ); + EventBus.subscribe(SedaVersionChangedEvent.class, event -> this.sedaVersion = event.getNewVersion()); try { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - } catch (IllegalAccessException | InstantiationException | - UnsupportedLookAndFeelException | ClassNotFoundException e) { + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } catch ( + IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException | ClassNotFoundException e + ) { getGlobalLogger().logIfDebug("Graphic env error", null); } System.out.println("Resip GraphicApp launched"); - if (theApp != null) - throw new ResipException("L'application a déjà été lancée"); + if (theApp != null) throw new ResipException("L'application a déjà été lancée"); theApp = this; // inner variables @@ -216,7 +212,8 @@ public ResipGraphicApp(CreationContext creationContext) throws ResipException { this.treatmentParameters = new TreatmentParameters(Preferences.getInstance()); getGlobalLogger().setDebugFlag(interfaceParameters.isDebugFlag()); - getGlobalLogger().logIfDebug("Resip prefs accessed from " + Preferences.getInstance().getPrefPropertiesFilename(), null); + getGlobalLogger() + .logIfDebug("Resip prefs accessed from " + Preferences.getInstance().getPrefPropertiesFilename(), null); // identification objects initialization try { @@ -240,11 +237,11 @@ public void run() { this.duplicatesWindow = new DuplicatesWindow(); currentWork = null; - if ((launchCreationContext instanceof DiskImportContext) || - (launchCreationContext instanceof SIPImportContext)) - importWork(launchCreationContext); - else - mainWindow.load(); + if ( + (launchCreationContext instanceof DiskImportContext) || + (launchCreationContext instanceof SIPImportContext) + ) importWork(launchCreationContext); + else mainWindow.load(); MailImportContext mic = new MailImportContext(Preferences.getInstance()); StoreExtractor.initDefaultExtractors(mic.isAllowsExternalToolsForTextExtraction()); @@ -252,7 +249,6 @@ public void run() { getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, exécution interrompue", e); System.exit(1); } - } /** @@ -289,21 +285,30 @@ public JMenuBar createMenu() { saveMenuItem = new JMenuItem("Sauver"); saveMenuItem.addActionListener(this); - saveMenuItem.setAccelerator(KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + saveMenuItem.setAccelerator( + KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()) + ); saveMenuItem.setEnabled(false); actionByMenuItem.put(saveMenuItem, "SaveWork"); fileMenu.add(saveMenuItem); saveAsMenuItem = new JMenuItem("Sauver sous..."); saveAsMenuItem.addActionListener(this); - saveAsMenuItem.setAccelerator(KeyStroke.getKeyStroke('S', InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + saveAsMenuItem.setAccelerator( + KeyStroke.getKeyStroke( + 'S', + InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + ) + ); saveAsMenuItem.setEnabled(false); actionByMenuItem.put(saveAsMenuItem, "SaveAsWork"); fileMenu.add(saveAsMenuItem); closeMenuItem = new JMenuItem("Fermer"); closeMenuItem.addActionListener(this); - closeMenuItem.setAccelerator(KeyStroke.getKeyStroke('W', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + closeMenuItem.setAccelerator( + KeyStroke.getKeyStroke('W', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()) + ); closeMenuItem.setEnabled(false); actionByMenuItem.put(closeMenuItem, "CloseWork"); fileMenu.add(closeMenuItem); @@ -354,7 +359,12 @@ public JMenuBar createMenu() { menuItem = new JMenuItem("Chercher des objets..."); menuItem.addActionListener(this); - menuItem.setAccelerator(KeyStroke.getKeyStroke('F', InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + menuItem.setAccelerator( + KeyStroke.getKeyStroke( + 'F', + InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + ) + ); actionByMenuItem.put(menuItem, "TechnicalSearch"); treatMenu.add(menuItem); @@ -392,19 +402,33 @@ public JMenuBar createMenu() { sedaValidationMenuItem = new JMenuItem("Vérifier la conformité " + sedaVersion.displayString() + "..."); sedaValidationMenuItem.addActionListener(this); - sedaValidationMenuItem.setAccelerator(KeyStroke.getKeyStroke('R', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + sedaValidationMenuItem.setAccelerator( + KeyStroke.getKeyStroke('R', Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx()) + ); actionByMenuItem.put(sedaValidationMenuItem, "CheckSEDASchema"); treatMenu.add(sedaValidationMenuItem); - sedaProfileValidationMenuItem = new JMenuItem("Vérifier la conformité à un profil " + sedaVersion.displayString() + "..."); + sedaProfileValidationMenuItem = new JMenuItem( + "Vérifier la conformité à un profil " + sedaVersion.displayString() + "..." + ); sedaProfileValidationMenuItem.addActionListener(this); - sedaProfileValidationMenuItem.setAccelerator(KeyStroke.getKeyStroke('R', InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + sedaProfileValidationMenuItem.setAccelerator( + KeyStroke.getKeyStroke( + 'R', + InputEvent.SHIFT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + ) + ); actionByMenuItem.put(sedaProfileValidationMenuItem, "CheckSpecificSEDASchemaProfile"); treatMenu.add(sedaProfileValidationMenuItem); menuItem = new JMenuItem("Vérifier EndDate > StartDate"); menuItem.addActionListener(this); - menuItem.setAccelerator(KeyStroke.getKeyStroke('R', InputEvent.ALT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); + menuItem.setAccelerator( + KeyStroke.getKeyStroke( + 'R', + InputEvent.ALT_DOWN_MASK + Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx() + ) + ); actionByMenuItem.put(menuItem, "CheckEndDate"); treatMenu.add(menuItem); @@ -518,129 +542,127 @@ public void actionPerformed(final ActionEvent actionEvent) { if (source instanceof JMenuItem) { String action = actionByMenuItem.get(source); - if (action == null) - System.err.println("unknown menu action"); - else - switch (action) { - // File Menu - case "LoadWork": - loadWork(); - break; - case "SaveWork": - saveWork(); - break; - case "SaveAsWork": - saveAsWork(); - break; - case "CloseWork": - closeWork(); - break; - case "EditPrefs": - editPrefs(); - break; - case "Exit": - exit(); - break; - case "EmptyWorkDir": - emptyWorkDir(); - break; - // Treat Menu - case "Search": - search(); - break; - case "TechnicalSearch": - technicalSearch(); - break; - case "Duplicates": - duplicates(); - break; - case "Clean": - clean(); - break; - case "Statistics": - generateStatistics(); - break; - case "SeeManifest": - seeManifest(); - break; - case "CheckSEDASchema": - checkSEDASchema(); - break; - case "CheckSpecificSEDASchemaProfile": - checkSpecificSEDASchemaProfile(); - break; - case "CheckEndDate": - checkEndDate(); - break; - case "RegenerateContinuousIds": - doRegenerateContinuousIds(); - break; - case "SortTreeViewer": - doSortTreeViewer(); - break; - // Context Menu - case "SeeImportContext": - seeImportContext(); - break; - case "EditExportContext": - editExportContext(); - break; - // Import Menu - case "ImportFromSIP": - importFromSIP(); - break; - case "ImportFromDIP": - importFromDIP(); - break; - case "ImportFromDisk": - importFromDisk(); - break; - case "ImportFromZip": - importFromZip(); - break; - case "ImportFromCSVTree": - importFromCSVTree(); - break; - case "ImportFromCSVMetadata": - importFromCSVMetadata(); - break; - case "ImportFromMail": - importFromMail(); - break; - // Export Menu - case "ExportToSEDASIP": - exportWork(ExportThread.SIP_ALL_EXPORT); - break; - case "ExportToSEDAXMLManifest": - exportWork(ExportThread.SIP_MANIFEST_EXPORT); - break; - case "ExportToDisk": - exportWork(ExportThread.DISK_EXPORT); - break; - case "ExportToCSVDisk": - exportWork(ExportThread.CSV_ALL_DISK_EXPORT); - break; - case "ExportToCSVZip": - exportWork(ExportThread.CSV_ALL_ZIP_EXPORT); - break; - case "ExportToCSVMetadataFile": - exportWork(ExportThread.CSV_METADATA_FILE_EXPORT); - break; - case "About": - about(); - break; - case "ToggleStructuredEdition": - toggleStructuredEdition(); - break; - case "ToggleDebugMode": - toggleDebugMode(); - break; - case "ToggleExperimentalMode": - toggleExperimentalMode(); - break; - default: - break; - } + if (action == null) System.err.println("unknown menu action"); + else switch (action) { + // File Menu + case "LoadWork": + loadWork(); + break; + case "SaveWork": + saveWork(); + break; + case "SaveAsWork": + saveAsWork(); + break; + case "CloseWork": + closeWork(); + break; + case "EditPrefs": + editPrefs(); + break; + case "Exit": + exit(); + break; + case "EmptyWorkDir": + emptyWorkDir(); + break; + // Treat Menu + case "Search": + search(); + break; + case "TechnicalSearch": + technicalSearch(); + break; + case "Duplicates": + duplicates(); + break; + case "Clean": + clean(); + break; + case "Statistics": + generateStatistics(); + break; + case "SeeManifest": + seeManifest(); + break; + case "CheckSEDASchema": + checkSEDASchema(); + break; + case "CheckSpecificSEDASchemaProfile": + checkSpecificSEDASchemaProfile(); + break; + case "CheckEndDate": + checkEndDate(); + break; + case "RegenerateContinuousIds": + doRegenerateContinuousIds(); + break; + case "SortTreeViewer": + doSortTreeViewer(); + break; + // Context Menu + case "SeeImportContext": + seeImportContext(); + break; + case "EditExportContext": + editExportContext(); + break; + // Import Menu + case "ImportFromSIP": + importFromSIP(); + break; + case "ImportFromDIP": + importFromDIP(); + break; + case "ImportFromDisk": + importFromDisk(); + break; + case "ImportFromZip": + importFromZip(); + break; + case "ImportFromCSVTree": + importFromCSVTree(); + break; + case "ImportFromCSVMetadata": + importFromCSVMetadata(); + break; + case "ImportFromMail": + importFromMail(); + break; + // Export Menu + case "ExportToSEDASIP": + exportWork(ExportThread.SIP_ALL_EXPORT); + break; + case "ExportToSEDAXMLManifest": + exportWork(ExportThread.SIP_MANIFEST_EXPORT); + break; + case "ExportToDisk": + exportWork(ExportThread.DISK_EXPORT); + break; + case "ExportToCSVDisk": + exportWork(ExportThread.CSV_ALL_DISK_EXPORT); + break; + case "ExportToCSVZip": + exportWork(ExportThread.CSV_ALL_ZIP_EXPORT); + break; + case "ExportToCSVMetadataFile": + exportWork(ExportThread.CSV_METADATA_FILE_EXPORT); + break; + case "About": + about(); + break; + case "ToggleStructuredEdition": + toggleStructuredEdition(); + break; + case "ToggleDebugMode": + toggleDebugMode(); + break; + case "ToggleExperimentalMode": + toggleExperimentalMode(); + break; + default: + break; + } } } @@ -719,20 +741,29 @@ private void loadWork() { String filename = "Non défini"; try { if (importThreadRunning) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Un import est en cours vous devez l'annuler ou attendre la fin avant de faire un chargement.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Un import est en cours vous devez l'annuler ou attendre la fin avant de faire un chargement.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return; } - if ((currentWork != null) && modifiedWork - && (UserInteractionDialog.getUserAnswer(mainWindow, - "Vous avez un contexte en cours non sauvegardé, un chargement l'écrasera.\n" - + "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG)) - return; + if ( + (currentWork != null) && + modifiedWork && + (UserInteractionDialog.getUserAnswer( + mainWindow, + "Vous avez un contexte en cours non sauvegardé, un chargement l'écrasera.\n" + + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG) + ) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsLoadDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -742,13 +773,19 @@ private void loadWork() { final SedaVersion sedaVersionFromWorkspace = Work.getSeda2VersionFromFile(filename); if (sedaVersionFromWorkspace != sedaVersion) { - if (UserInteractionDialog.getUserAnswer(mainWindow, + if ( + UserInteractionDialog.getUserAnswer( + mainWindow, "Pour charger ce fichier il faut faire passer l'interface en " + - sedaVersion + "\n" + - "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG) - return; + sedaVersion + + "\n" + + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG + ) return; EventBus.publish(new SedaVersionChangedEvent(sedaVersionFromWorkspace)); treatmentParameters.toPrefs(Preferences.getInstance()); } @@ -763,10 +800,13 @@ private void loadWork() { Preferences.getInstance().setPrefsLoadDirFromChild(filename); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur de chargement de [" + filename + "]\n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur de chargement de [" + filename + "]\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); getGlobalLogger().log(ResipLogger.STEP, "Erreur de chargement de [" + filename + "]", e); mainWindow.setCursor(Cursor.getDefaultCursor()); } @@ -775,21 +815,22 @@ private void loadWork() { // MenuItem Save private void saveWork() { - if (filenameWork != null) - try { - mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - currentWork.save(filenameWork); - mainWindow.setCursor(Cursor.getDefaultCursor()); - setModifiedContext(false); - } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur de sauvegarde de [" + filenameWork + "]\n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.STEP, - "Resip.Graphic: Erreur de sauvegarde de [" + filenameWork + "]", e); - mainWindow.setCursor(Cursor.getDefaultCursor()); - } + if (filenameWork != null) try { + mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + currentWork.save(filenameWork); + mainWindow.setCursor(Cursor.getDefaultCursor()); + setModifiedContext(false); + } catch (Exception e) { + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur de sauvegarde de [" + filenameWork + "]\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger().log(ResipLogger.STEP, "Resip.Graphic: Erreur de sauvegarde de [" + filenameWork + "]", e); + mainWindow.setCursor(Cursor.getDefaultCursor()); + } } // MenuItem SaveAs @@ -802,12 +843,17 @@ private void saveAsWork() { if (fileChooser.showSaveDialog(mainWindow) == JFileChooser.APPROVE_OPTION) { filename = fileChooser.getSelectedFile().getCanonicalPath(); - if ((new File(filename).exists()) && - (UserInteractionDialog.getUserAnswer(mainWindow, - "Le fichier [" + filename + "] existe. Voulez-vous le remplacer ?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG)) - return; + if ( + (new File(filename).exists()) && + (UserInteractionDialog.getUserAnswer( + mainWindow, + "Le fichier [" + filename + "] existe. Voulez-vous le remplacer ?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG) + ) return; mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); currentWork.save(filename); mainWindow.setCursor(Cursor.getDefaultCursor()); @@ -817,10 +863,13 @@ private void saveAsWork() { Preferences.getInstance().setPrefsLoadDirFromChild(filename); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur de sauvegarde de [" + filename + "]\n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur de sauvegarde de [" + filename + "]\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); getGlobalLogger().log(ResipLogger.STEP, "Erreur de sauvegarde de [" + filename + "]", e); mainWindow.setCursor(Cursor.getDefaultCursor()); } @@ -829,13 +878,19 @@ private void saveAsWork() { // MenuItem Close private void closeWork() { try { - if ((currentWork != null) && modifiedWork - && UserInteractionDialog.getUserAnswer(mainWindow, - "Vous avez un contexte en cours non sauvegardé, la fermeture entrainera la perte des modifications.\n" - + "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG) - return; + if ( + (currentWork != null) && + modifiedWork && + UserInteractionDialog.getUserAnswer( + mainWindow, + "Vous avez un contexte en cours non sauvegardé, la fermeture entrainera la perte des modifications.\n" + + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG + ) return; currentWork = null; setFilenameWork(null); @@ -843,12 +898,19 @@ private void closeWork() { setContextLoaded(false); mainWindow.load(); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur de fermeture du contexte en cours [" + filenameWork + "]\n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.STEP, "Resip.Graphic: Erreur de fermeture du contexte en cours [" - + filenameWork + "]", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur de fermeture du contexte en cours [" + filenameWork + "]\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.Graphic: Erreur de fermeture du contexte en cours [" + filenameWork + "]", + e + ); } } @@ -876,17 +938,21 @@ void editPrefs() { experimentalMenuItem.setState(interfaceParameters.isExperimentalFlag()); structuredMenuItem.setState(interfaceParameters.isStructuredMetadataEditionFlag()); toggleStructuredEdition(); - ResipLogger.createGlobalLogger(preferencesDialog.cc.getWorkDir() + File.separator + "log.txt", - getGlobalLogger().getProgressLogLevel()); + ResipLogger.createGlobalLogger( + preferencesDialog.cc.getWorkDir() + File.separator + "log.txt", + getGlobalLogger().getProgressLogLevel() + ); } } catch (ResipException e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible d'éditer les préférences \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, - "resip.graphicapp: erreur fatale, impossible d'éditer les préférences", e); - + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible d'éditer les préférences \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible d'éditer les préférences", e); } } @@ -896,35 +962,47 @@ private void emptyWorkDir() { CreationContext cc; try { if (currentWork != null) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Vous devez fermer tout travail en cours avant de\n" + - "procéder au nettoyage du répertoire de travail", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Vous devez fermer tout travail en cours avant de\n" + + "procéder au nettoyage du répertoire de travail", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return; } cc = new CreationContext(Preferences.getInstance()); - if (UserInteractionDialog.getUserAnswer(mainWindow, + if ( + UserInteractionDialog.getUserAnswer( + mainWindow, "Vous allez effacer tous les répertoires temporaires " + - "d'extraction (finissant par \"-tmpdir\")\ndans le répertoire de travail\n" + - cc.getWorkDir() + "\n" + - "Voulez-vous continuer?", + "d'extraction (finissant par \"-tmpdir\")\ndans le répertoire de travail\n" + + cc.getWorkDir() + + "\n" + + "Voulez-vous continuer?", "Confirmation", UserInteractionDialog.WARNING_DIALOG, "Ces répertoires temporaires sont utilisés pour stocker les fichiers issus " + - "des extraction de conteneurs de messageries ou de SIP, DIP...\nAssurez-vous que vous n'avez" + - " pas de sauvegarde de travail en cours qui utilise ces fichiers, avant de les supprimer.") != OK_DIALOG) - return; + "des extraction de conteneurs de messageries ou de SIP, DIP...\nAssurez-vous que vous n'avez" + + " pas de sauvegarde de travail en cours qui utilise ces fichiers, avant de les supprimer." + ) != + OK_DIALOG + ) return; InOutDialog inOutDialog = new InOutDialog(mainWindow, "Nettoyage"); CleanThread cleanThread = new CleanThread(cc.getWorkDir(), inOutDialog); cleanThread.execute(); inOutDialog.setVisible(true); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire le nettoyage \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire le nettoyage", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire le nettoyage \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire le nettoyage", e); } } @@ -935,20 +1013,29 @@ private void emptyWorkDir() { */ public void exit() { try { - if ((currentWork != null) && modifiedWork - && UserInteractionDialog.getUserAnswer(mainWindow, - "Vous avez un contexte en cours non sauvegardé, la fermeture de l'application entrainera la perte des modifications.\n" - + "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG) - return; + if ( + (currentWork != null) && + modifiedWork && + UserInteractionDialog.getUserAnswer( + mainWindow, + "Vous avez un contexte en cours non sauvegardé, la fermeture de l'application entrainera la perte des modifications.\n" + + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG + ) return; System.exit(0); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur de fermeture de l'application\n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur de fermeture de l'application\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); getGlobalLogger().log(ResipLogger.STEP, "resip.graphicapp: erreur de fermeture de l'application", e); } } @@ -1017,21 +1104,37 @@ void checkSpecificSEDASchemaProfile() { JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (fileChooser.showOpenDialog(mainWindow) == JFileChooser.APPROVE_OPTION) { - InOutDialog inOutDialog = new InOutDialog(mainWindow, "Vérification Profil " + sedaVersion.displayString()); - CheckProfileThread checkProfileThread = new CheckProfileThread(fileChooser.getSelectedFile() - .getAbsolutePath(), inOutDialog); + InOutDialog inOutDialog = new InOutDialog( + mainWindow, + "Vérification Profil " + sedaVersion.displayString() + ); + CheckProfileThread checkProfileThread = new CheckProfileThread( + fileChooser.getSelectedFile().getAbsolutePath(), + inOutDialog + ); completeResipWork(); checkProfileThread.execute(); inOutDialog.setVisible(true); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire la vérification de confirmité au profil " + sedaVersion.displayString() + "\n->" - + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire la " + - "vérification de confirmité au profil " + sedaVersion.displayString(), e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire la vérification de confirmité au profil " + + sedaVersion.displayString() + + "\n->" + + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log( + ResipLogger.ERROR, + "resip.graphicapp: erreur fatale, impossible de faire la " + + "vérification de confirmité au profil " + + sedaVersion.displayString(), + e + ); } } @@ -1087,15 +1190,26 @@ void seeImportContext() { if (currentWork != null) { CreationContext oic = currentWork.getCreationContext(); if (oic != null) { - CreationContextDialog creationContextDialog = new CreationContextDialog(mainWindow, oic, - currentWork.getDataObjectPackage()); + CreationContextDialog creationContextDialog = new CreationContextDialog( + mainWindow, + oic, + currentWork.getDataObjectPackage() + ); creationContextDialog.setVisible(true); - } else - UserInteractionDialog.getUserAnswer(mainWindow, "Pas de contexte de création défini", "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - } else - UserInteractionDialog.getUserAnswer(mainWindow, "Pas de contexte ouvert", "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + } else UserInteractionDialog.getUserAnswer( + mainWindow, + "Pas de contexte de création défini", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + } else UserInteractionDialog.getUserAnswer( + mainWindow, + "Pas de contexte ouvert", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); } // MenuItem Edit ExportContext @@ -1108,34 +1222,50 @@ void editExportContext() { if (currentWork.getExportContext() == null) { currentWork.setExportContext(new ExportContext(Preferences.getInstance())); } - ExportContextDialog exportContextDialog = new ExportContextDialog(mainWindow, currentWork.getExportContext()); + ExportContextDialog exportContextDialog = new ExportContextDialog( + mainWindow, + currentWork.getExportContext() + ); exportContextDialog.setVisible(true); if (exportContextDialog.getReturnValue() == OK_DIALOG) { currentWork.setExportContext(exportContextDialog.gmc); setModifiedContext(true); } - } else - UserInteractionDialog.getUserAnswer(mainWindow, "Pas de contexte ouvert", "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + } else UserInteractionDialog.getUserAnswer( + mainWindow, + "Pas de contexte ouvert", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); } // Import Menu private boolean isImportActionWrong() { if (importThreadRunning) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Un import est en cours vous devez l'annuler ou attendre la fin avant de faire un autre import.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Un import est en cours vous devez l'annuler ou attendre la fin avant de faire un autre import.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return true; } - return (currentWork != null) && modifiedWork - && (UserInteractionDialog.getUserAnswer(mainWindow, - "Vous avez un contexte en cours non sauvegardé, un import l'écrasera.\n" - + "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG); + return ( + (currentWork != null) && + modifiedWork && + (UserInteractionDialog.getUserAnswer( + mainWindow, + "Vous avez un contexte en cours non sauvegardé, un import l'écrasera.\n" + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG) + ); } private void importWork(CreationContext cc) { @@ -1145,11 +1275,15 @@ private void importWork(CreationContext cc) { importThread.execute(); inOutDialog.setVisible(true); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1160,8 +1294,7 @@ private void importWork(CreationContext cc) { */ void importFromSIP() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1171,11 +1304,15 @@ void importFromSIP() { importWork(oic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1186,8 +1323,7 @@ void importFromSIP() { */ void importFromDIP() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1197,11 +1333,15 @@ void importFromDIP() { importWork(oic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1212,8 +1352,7 @@ void importFromDIP() { */ void importFromDisk() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); @@ -1223,11 +1362,15 @@ void importFromDisk() { importWork(oic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1238,8 +1381,7 @@ void importFromDisk() { */ void importFromZip() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1249,11 +1391,15 @@ void importFromZip() { importWork(oic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1264,8 +1410,7 @@ void importFromZip() { */ void importFromMail() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); @@ -1274,17 +1419,20 @@ void importFromMail() { mic.setOnDiskInput(fileChooser.getSelectedFile().toString()); MailImportContextDialog micd = new MailImportContextDialog(mainWindow, mic); micd.setVisible(true); - if (micd.returnValue != OK_DIALOG) - return; + if (micd.returnValue != OK_DIALOG) return; micd.setMailImportContextFromDialog(mic); importWork(mic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1295,8 +1443,7 @@ void importFromMail() { */ void importFromCSVTree() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1306,11 +1453,15 @@ void importFromCSVTree() { importWork(ctic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } @@ -1321,8 +1472,7 @@ void importFromCSVTree() { */ void importFromCSVMetadata() { try { - if (isImportActionWrong()) - return; + if (isImportActionWrong()) return; JFileChooser fileChooser = new JFileChooser(Preferences.getInstance().getPrefsImportDir()); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1332,25 +1482,27 @@ void importFromCSVMetadata() { importWork(cmic); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.ERROR, "resip.graphicapp: erreur fatale, impossible de faire l'import", e); } } // Export Menu private boolean completeResipWork() { - if (currentWork == null) - return true; + if (currentWork == null) return true; if (currentWork.getExportContext() == null) { ExportContext newExportContext = new ExportContext(Preferences.getInstance()); ExportContextDialog exportContextDialog = new ExportContextDialog(mainWindow, newExportContext); exportContextDialog.setVisible(true); - if (exportContextDialog.getReturnValue() == KO_DIALOG) - return true; + if (exportContextDialog.getReturnValue() == KO_DIALOG) return true; currentWork.setExportContext(exportContextDialog.gmc); } return false; @@ -1361,8 +1513,7 @@ private boolean completeResipWork() { private void exportWork(int exportType) { String defaultFilename; try { - if (completeResipWork()) - return; + if (completeResipWork()) return; JFileChooser fileChooser; if (currentWork.getExportContext().getOnDiskOutput() != null) { fileChooser = new JFileChooser(currentWork.getExportContext().getOnDiskOutput()); @@ -1386,26 +1537,40 @@ private void exportWork(int exportType) { defaultFilename += "metadata.csv"; break; default: - throw new SEDALibException("type d'export ["+exportType+"] inconnu"); + throw new SEDALibException("type d'export [" + exportType + "] inconnu"); } fileChooser.setSelectedFile(new File(defaultFilename)); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - } else - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } else fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showSaveDialog(mainWindow) == JFileChooser.APPROVE_OPTION) { Path path = Paths.get(fileChooser.getSelectedFile().getAbsolutePath()); if (Files.exists(path)) { - if (!Files.isDirectory(path) && UserInteractionDialog.getUserAnswer(mainWindow, - "Le fichier [" + path + "] existe. Voulez-vous le remplacer ?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG) - return; - else if (Files.isDirectory(path) && Files.list(path).findAny().isPresent() && UserInteractionDialog.getUserAnswer(mainWindow, - "Le répertoire [" + path + "] existe. Les fichiers exportés sur le disque vont " + - "se mélanger avec ceux déjà existants. Voulez-vous continuer? ?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != OK_DIALOG) - return; + if ( + !Files.isDirectory(path) && + UserInteractionDialog.getUserAnswer( + mainWindow, + "Le fichier [" + path + "] existe. Voulez-vous le remplacer ?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG + ) return; + else if ( + Files.isDirectory(path) && + Files.list(path).findAny().isPresent() && + UserInteractionDialog.getUserAnswer( + mainWindow, + "Le répertoire [" + + path + + "] existe. Les fichiers exportés sur le disque vont " + + "se mélanger avec ceux déjà existants. Voulez-vous continuer? ?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + OK_DIALOG + ) return; } InOutDialog inOutDialog = new InOutDialog(mainWindow, "Export"); currentWork.getExportContext().setOnDiskOutput(path.toString()); @@ -1414,9 +1579,13 @@ else if (Files.isDirectory(path) && Files.list(path).findAny().isPresent() && Us inOutDialog.setVisible(true); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, "Erreur fatale, impossible de faire l'export \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de faire l'export \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); getGlobalLogger().log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de faire l'export", e); } } @@ -1434,7 +1603,10 @@ private void about() { version = p.getProperty("version", ""); builddate = p.getProperty("builddate", ""); } - AboutDialog dialog = new AboutDialog(mainWindow, "Application Resip\n - Version : " + version + "\n - Date : " + builddate); + AboutDialog dialog = new AboutDialog( + mainWindow, + "Application Resip\n - Version : " + version + "\n - Date : " + builddate + ); dialog.setVisible(true); } catch (Exception ignored) { //no real case @@ -1445,10 +1617,12 @@ private void toggleStructuredEdition() { try { interfaceParameters.setStructuredMetadataEditionFlag(structuredMenuItem.getState()); if (ResipGraphicApp.getTheApp().interfaceParameters.isStructuredMetadataEditionFlag()) { - StructuredArchiveUnitEditorPanel structuredArchiveUnitEditorPanel = new StructuredArchiveUnitEditorPanel(); + StructuredArchiveUnitEditorPanel structuredArchiveUnitEditorPanel = + new StructuredArchiveUnitEditorPanel(); ResipGraphicApp.getTheWindow().itemPane.setTopComponent(structuredArchiveUnitEditorPanel); ResipGraphicApp.getTheWindow().auMetadataPane = structuredArchiveUnitEditorPanel; - StructuredDataObjectGroupEditorPanel structuredDataObjectGroupEditorPanel = new StructuredDataObjectGroupEditorPanel(); + StructuredDataObjectGroupEditorPanel structuredDataObjectGroupEditorPanel = + new StructuredDataObjectGroupEditorPanel(); ResipGraphicApp.getTheWindow().itemPane.setBottomComponent(structuredDataObjectGroupEditorPanel); ResipGraphicApp.getTheWindow().dogMetadataPane = structuredDataObjectGroupEditorPanel; } else { @@ -1460,13 +1634,17 @@ private void toggleStructuredEdition() { ResipGraphicApp.getTheWindow().dogMetadataPane = xmlDataObjectGroupEditorPanel; } DataObjectPackageTreeNode node = ResipGraphicApp.getTheWindow().treePane.getDisplayedTreeNode(); - if (node != null) - ResipGraphicApp.getTheWindow().auMetadataPane.editArchiveUnit(node.getArchiveUnit()); + if (node != null) ResipGraphicApp.getTheWindow().auMetadataPane.editArchiveUnit(node.getArchiveUnit()); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, "Erreur fatale, impossible de changer de type d'édition \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de changer de type d'édition", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de changer de type d'édition \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de changer de type d'édition", e); } } @@ -1474,10 +1652,15 @@ private void toggleDebugMode() { try { interfaceParameters.setDebugFlag(debugMenuItem.getState()); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, "Erreur fatale, impossible de passer en mode débug \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de passer en mode débug", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de passer en mode débug \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de passer en mode débug", e); } } @@ -1485,10 +1668,19 @@ private void toggleExperimentalMode() { try { interfaceParameters.setExperimentalFlag(experimentalMenuItem.getState()); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(mainWindow, "Erreur fatale, impossible de passer en mode expérimental \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - getGlobalLogger().log(ResipLogger.STEP, "resip.graphicapp: erreur fatale, impossible de changer de type de mode de débug", e); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Erreur fatale, impossible de passer en mode expérimental \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + getGlobalLogger() + .log( + ResipLogger.STEP, + "resip.graphicapp: erreur fatale, impossible de changer de type de mode de débug", + e + ); } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java index 9133f2b2..ddd4a698 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/app/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.app; \ No newline at end of file +package fr.gouv.vitam.tools.resip.app; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java index 18d16b8e..5cfca237 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/DustbinItem.java @@ -47,6 +47,7 @@ * The type Dustbin item. */ public class DustbinItem { + /** * The Former root. */ @@ -79,13 +80,13 @@ public class DustbinItem { * @param node the node */ public DustbinItem(DataObjectPackageTreeNode parentNode, DataObjectPackageTreeNode node) { - this.node = node; - this.formerRoot = parentNode; - this.removedArchiveUnitList = new ArrayList<>(); - this.removedDataObjectGroupList = new ArrayList<>(); - this.removedBinaryDataObjectList = new ArrayList<>(); - this.removedPhysicalDataObjectList = new ArrayList<>(); - } + this.node = node; + this.formerRoot = parentNode; + this.removedArchiveUnitList = new ArrayList<>(); + this.removedDataObjectGroupList = new ArrayList<>(); + this.removedBinaryDataObjectList = new ArrayList<>(); + this.removedPhysicalDataObjectList = new ArrayList<>(); + } /** * Add tree node. @@ -93,15 +94,13 @@ public DustbinItem(DataObjectPackageTreeNode parentNode, DataObjectPackageTreeNo * @param node the node */ public void addTreeNode(DataObjectPackageTreeNode node) { - if (node.getArchiveUnit()!=null) - addArchiveUnit(node.getArchiveUnit()); - else if (node.getDataObject()!=null) { - DataObject zod=node.getDataObject(); - if (zod instanceof DataObjectGroup) - addDataObjectGroup((DataObjectGroup)zod); - //FIXME ne traite les autres DataObject car à terme un TreeNode ne sera qu'un ArchiveUnit ou un DataObjectGroup - } - } + if (node.getArchiveUnit() != null) addArchiveUnit(node.getArchiveUnit()); + else if (node.getDataObject() != null) { + DataObject zod = node.getDataObject(); + if (zod instanceof DataObjectGroup) addDataObjectGroup((DataObjectGroup) zod); + //FIXME ne traite les autres DataObject car à terme un TreeNode ne sera qu'un ArchiveUnit ou un DataObjectGroup + } + } /** * Add archive unit. @@ -109,8 +108,8 @@ else if (node.getDataObject()!=null) { * @param archiveUnit the archive unit */ public void addArchiveUnit(ArchiveUnit archiveUnit) { - removedArchiveUnitList.add(archiveUnit); - } + removedArchiveUnitList.add(archiveUnit); + } /** * Add data object group. @@ -118,8 +117,8 @@ public void addArchiveUnit(ArchiveUnit archiveUnit) { * @param dataObjectGroup the data object group */ public void addDataObjectGroup(DataObjectGroup dataObjectGroup) { - removedDataObjectGroupList.add(dataObjectGroup); - removedBinaryDataObjectList.addAll(dataObjectGroup.getBinaryDataObjectList()); - removedPhysicalDataObjectList.addAll(dataObjectGroup.getPhysicalDataObjectList()); - } + removedDataObjectGroupList.add(dataObjectGroup); + removedBinaryDataObjectList.addAll(dataObjectGroup.getBinaryDataObjectList()); + removedPhysicalDataObjectList.addAll(dataObjectGroup.getPhysicalDataObjectList()); + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java index 9550988c..5a220974 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/NullDeserializer.java @@ -45,6 +45,7 @@ import java.io.IOException; public class NullDeserializer extends StdDeserializer { + protected NullDeserializer() { super((Class) null); } @@ -56,12 +57,9 @@ public T deserialize(JsonParser parser, DeserializationContext deserializationCo parser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); while (objectCount >= 0) { token = parser.nextToken(); - if (token == JsonToken.START_OBJECT) - objectCount++; - else if (token == JsonToken.END_OBJECT) - objectCount--; + if (token == JsonToken.START_OBJECT) objectCount++; + else if (token == JsonToken.END_OBJECT) objectCount--; } return null; } } - diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java index e77a3970..2b7f139a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/StatisticData.java @@ -43,7 +43,8 @@ * The type Statistic data. */ public class StatisticData { - private String formatCategory; + + private String formatCategory; private int objectNumber; private long minSize; private long maxSize; @@ -56,21 +57,21 @@ public class StatisticData { * @param formatCategory the format category * @param sizeList the size list */ - public StatisticData(String formatCategory, List sizeList){ - this.formatCategory=formatCategory; - this.objectNumber=sizeList.size(); - long min=Long.MAX_VALUE; - long max=-1; - long accu=0; - for (long size:sizeList){ - if (sizemax) max=size; - accu+=size; + public StatisticData(String formatCategory, List sizeList) { + this.formatCategory = formatCategory; + this.objectNumber = sizeList.size(); + long min = Long.MAX_VALUE; + long max = -1; + long accu = 0; + for (long size : sizeList) { + if (size < min) min = size; + if (size > max) max = size; + accu += size; } - this.minSize=min; - this.maxSize=max; - this.meanSize=(double)accu/(double)this.objectNumber; - this.totalSize=accu; + this.minSize = min; + this.maxSize = max; + this.meanSize = (double) accu / (double) this.objectNumber; + this.totalSize = accu; } /** diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java index 0b63f820..7fba15ba 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/Work.java @@ -129,10 +129,7 @@ public Work(DataObjectPackage dataObjectPackage, CreationContext creationContext this.creationContext = creationContext; this.exportContext = exportContext; - EventBus.subscribe( - SedaVersionChangedEvent.class, - event -> this.version = event.getNewVersion() - ); + EventBus.subscribe(SedaVersionChangedEvent.class, event -> this.version = event.getNewVersion()); } /** @@ -143,18 +140,27 @@ public Work(DataObjectPackage dataObjectPackage, CreationContext creationContext * @throws SEDALibException the SEDA lib exception * @throws InterruptedException the interrupted exception */ - public String doVitamNormalize(SEDALibProgressLogger spl) - throws SEDALibException, InterruptedException { + public String doVitamNormalize(SEDALibProgressLogger spl) throws SEDALibException, InterruptedException { Instant start = Instant.now(); - String log = "resip: début de la vérification de l'absence de cycle et de la normalisation Vitam de la structure"; + String log = + "resip: début de la vérification de l'absence de cycle et de la normalisation Vitam de la structure"; doProgressLog(spl, SEDALibProgressLogger.GLOBAL, log, null); dataObjectPackage.vitamNormalize(spl); - doProgressLog(spl, SEDALibProgressLogger.STEP, "resip: " + - dataObjectPackage.getArchiveUnitCount() + " ArchiveUnits normalisées", null); + doProgressLog( + spl, + SEDALibProgressLogger.STEP, + "resip: " + dataObjectPackage.getArchiveUnitCount() + " ArchiveUnits normalisées", + null + ); Instant end = Instant.now(); - doProgressLog(spl, SEDALibProgressLogger.GLOBAL, "resip: opération terminée en " + Duration.between(start, end).toString().substring(2), null); + doProgressLog( + spl, + SEDALibProgressLogger.GLOBAL, + "resip: opération terminée en " + Duration.between(start, end).toString().substring(2), + null + ); return "Vérification de l'absence de cycle et normalisation Vitam effectuées"; } @@ -175,13 +181,15 @@ public static SedaVersion getSeda2VersionFromFile(String file) throws ResipExcep module.addDeserializer(CreationContext.class, new NullDeserializer()); mapper.registerModule(module); ZipEntry ze = zis.getNextEntry(); - if (!ze.getName().equals(JSON_FILENAME)) - throw new ResipException( - "Resip: Le fichier [" + file + "] n'est pas une sauvegarde de session Resip"); + if (!ze.getName().equals(JSON_FILENAME)) throw new ResipException( + "Resip: Le fichier [" + file + "] n'est pas une sauvegarde de session Resip" + ); ow = mapper.readValue(zis, Work.class); } catch (IOException e) { - throw new ResipException("Resip: La lecture du fichier [" + file - + "] ne permet pas de retrouver une session Resip", e); + throw new ResipException( + "Resip: La lecture du fichier [" + file + "] ne permet pas de retrouver une session Resip", + e + ); } return ow.version; } @@ -202,19 +210,23 @@ public static Work createFromFile(String file) throws ResipException { module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); mapper.registerModule(module); ZipEntry ze = zis.getNextEntry(); - if (!ze.getName().equals(JSON_FILENAME)) - throw new ResipException( - "Resip: Le fichier [" + file + "] n'est pas une sauvegarde de session Resip"); + if (!ze.getName().equals(JSON_FILENAME)) throw new ResipException( + "Resip: Le fichier [" + file + "] n'est pas une sauvegarde de session Resip" + ); ow = mapper.readValue(zis, Work.class); // some fields need to be computed or defined after the load phase from Json ow.getDataObjectPackage().getGhostRootAu().setDataObjectPackage(ow.getDataObjectPackage()); - for (Map.Entry pair : ow.getDataObjectPackage().getAuInDataObjectPackageIdMap() - .entrySet()) { + for (Map.Entry pair : ow + .getDataObjectPackage() + .getAuInDataObjectPackageIdMap() + .entrySet()) { pair.getValue().setDataObjectPackage(ow.getDataObjectPackage()); } - for (Map.Entry pair : ow.getDataObjectPackage().getDogInDataObjectPackageIdMap() - .entrySet()) { + for (Map.Entry pair : ow + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .entrySet()) { DataObjectGroup dog = pair.getValue(); dog.setDataObjectPackage(ow.getDataObjectPackage()); for (BinaryDataObject bdo : dog.getBinaryDataObjectList()) { @@ -227,8 +239,10 @@ public static Work createFromFile(String file) throws ResipException { } } } catch (IOException e) { - throw new ResipException("Resip: La lecture du fichier [" + file - + "] ne permet pas de retrouver une session Resip", e); + throw new ResipException( + "Resip: La lecture du fichier [" + file + "] ne permet pas de retrouver une session Resip", + e + ); } return ow; } @@ -246,7 +260,7 @@ public void save(String file) { module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); mapper.registerModule(module); mapper.enable(SerializationFeature.INDENT_OUTPUT); - try(ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file))) { + try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file))) { ZipEntry e = new ZipEntry(JSON_FILENAME); zos.putNextEntry(e); mapper.writeValue(zos, this); @@ -255,7 +269,6 @@ public void save(String file) { } catch (IOException e) { ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Impossible de sauvegarder la session", e); } - } /** diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java index 5799373b..73da3c7d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/data/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.data; \ No newline at end of file +package fr.gouv.vitam.tools.resip.data; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java index 538a23b2..ef54f3f7 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/Event.java @@ -37,5 +37,4 @@ */ package fr.gouv.vitam.tools.resip.event; -public interface Event { -} +public interface Event {} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java index 3ce16037..f532b516 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/EventBus.java @@ -46,9 +46,7 @@ public class EventBus { private static final Map, List>> listenersMap = new ConcurrentHashMap<>(); public static void subscribe(Class eventType, EventListener listener) { - listenersMap - .computeIfAbsent(eventType, k -> new CopyOnWriteArrayList<>()) - .add(listener); + listenersMap.computeIfAbsent(eventType, k -> new CopyOnWriteArrayList<>()).add(listener); } @SuppressWarnings("unchecked") diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java index ebcb6afb..5de13b2f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/event/SedaVersionChangedEvent.java @@ -40,6 +40,7 @@ import fr.gouv.vitam.tools.sedalib.core.seda.SedaVersion; public class SedaVersionChangedEvent implements Event { + private final SedaVersion newVersion; public SedaVersionChangedEvent(SedaVersion newVersion) { diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java index 610449ab..d34036a4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/AboutDialog.java @@ -56,6 +56,7 @@ * The type About dialog. */ public class AboutDialog extends JDialog { + private JTextArea messageTextArea; private JButton okButton; private JButton reinitPrefsButton; @@ -73,7 +74,8 @@ public class AboutDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(AboutDialog.class); } @@ -86,7 +88,6 @@ public AboutDialog(JFrame owner) { this(owner, "This is a test about"); } - /** * Instantiates a new About dialog. * @@ -100,27 +101,26 @@ public AboutDialog(JFrame owner, String message) { setPreferredSize(new Dimension(550, 250)); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.rowWeights = new double[]{1.0, 0.0}; - gridBagLayout.columnWeights = new double[]{0,0,1.0,0}; + gridBagLayout.rowWeights = new double[] { 1.0, 0.0 }; + gridBagLayout.columnWeights = new double[] { 0, 0, 1.0, 0 }; getContentPane().setLayout(gridBagLayout); try { - Image vitamImage= ImageIO.read(getClass().getResourceAsStream("/small-logo_vitam.png")); + Image vitamImage = ImageIO.read(getClass().getResourceAsStream("/small-logo_vitam.png")); ImagePanel vitamPanel = new ImagePanel(vitamImage); - vitamPanel.setPreferredSize(new Dimension(281,100)); - vitamPanel.setMaximumSize(new Dimension(281,100)); - vitamPanel.setMinimumSize(new Dimension(281,100)); - vitamPanel.setSize(new Dimension(281,100)); + vitamPanel.setPreferredSize(new Dimension(281, 100)); + vitamPanel.setMaximumSize(new Dimension(281, 100)); + vitamPanel.setMinimumSize(new Dimension(281, 100)); + vitamPanel.setSize(new Dimension(281, 100)); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.CENTER; - gbc.weightx=0.0; - gbc.gridwidth=3; + gbc.weightx = 0.0; + gbc.gridwidth = 3; gbc.insets = new Insets(5, 5, 5, 5); getContentPane().add(vitamPanel, gbc); - } catch (IOException ignored) { - } + } catch (IOException ignored) {} JTextArea messageTextArea = new JTextArea(); messageTextArea.setText(message); @@ -132,7 +132,7 @@ public AboutDialog(JFrame owner, String message) { gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 0; - gbc.weightx=1.0; + gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; @@ -141,20 +141,22 @@ public AboutDialog(JFrame owner, String message) { JLabel urlLabel = new JLabel(); urlLabel.setText("Aller sur www.programmevitam.fr"); - urlLabel.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - try { - Desktop.getDesktop().browse(new URI("http://www.programmevitam.fr/pages/ressources/resip")); - } catch (URISyntaxException | IOException ex) { - //It looks like there's a problem + urlLabel.addMouseListener( + new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + try { + Desktop.getDesktop().browse(new URI("http://www.programmevitam.fr/pages/ressources/resip")); + } catch (URISyntaxException | IOException ex) { + //It looks like there's a problem + } } } - }); + ); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 1; - gbc.weightx=1.0; + gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; @@ -177,7 +179,7 @@ public void mouseClicked(MouseEvent e) { gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; - gbc.gridwidth=2; + gbc.gridwidth = 2; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(5, 5, 5, 5); @@ -217,12 +219,17 @@ private void buttonOK() { private void buttonReinitPrefs() { try { Preferences.getInstance().reinitialisePrefs(); - ResipGraphicApp.getTheApp().treatmentParameters =new TreatmentParameters(Preferences. - getInstance()); + ResipGraphicApp.getTheApp().treatmentParameters = new TreatmentParameters(Preferences.getInstance()); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheApp().mainWindow, "Erreur fatale, réinitialisation des préférences impossible \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Erreur fatale, réinitialisation des préférences impossible",e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheApp().mainWindow, + "Erreur fatale, réinitialisation des préférences impossible \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log(ResipLogger.STEP, "Erreur fatale, réinitialisation des préférences impossible", e); } this.setVisible(false); } @@ -235,9 +242,14 @@ private void buttonSavePrefs() { Preferences.getInstance().save(fileChooser.getSelectedFile().getAbsolutePath()); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheApp().mainWindow, "Sauvegarde des préférences impossible \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Sauvegarde des préférences impossible",e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheApp().mainWindow, + "Sauvegarde des préférences impossible \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Sauvegarde des préférences impossible", e); } this.setVisible(false); } @@ -250,9 +262,14 @@ private void buttonImportPrefs() { Preferences.getInstance().load(fileChooser.getSelectedFile().getAbsolutePath()); } } catch (Exception e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheApp().mainWindow, "Import des préférences impossible \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Import des préférences impossible",e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheApp().mainWindow, + "Import des préférences impossible \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Import des préférences impossible", e); } this.setVisible(false); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java index d3e31222..ede7617e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java @@ -79,7 +79,8 @@ public class BigTextEditDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(BigTextEditDialog.class); } @@ -90,7 +91,14 @@ public static void main(String[] args) throws ClassNotFoundException, Unsupporte * @throws SEDALibException the seda lib exception */ public BigTextEditDialog(JFrame owner) throws SEDALibException, IOException { - this(owner, FileUtils.readFileToString(new File("resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java"),"UTF8"),"Code"); + this( + owner, + FileUtils.readFileToString( + new File("resip/src/main/java/fr/gouv/vitam/tools/resip/frame/BigTextEditDialog.java"), + "UTF8" + ), + "Code" + ); } /** @@ -108,9 +116,9 @@ public BigTextEditDialog(JFrame owner, String text, String title) { setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); setPreferredSize(new Dimension(1024, 600)); - gbl=new GridBagLayout(); - gbl.rowWeights = new double[]{1.0,0.0}; - gbl.columnWeights = new double[]{0.0,1.0,0.0}; + gbl = new GridBagLayout(); + gbl.rowWeights = new double[] { 1.0, 0.0 }; + gbl.columnWeights = new double[] { 0.0, 1.0, 0.0 }; Container contentPane = getContentPane(); contentPane.setLayout(gbl); @@ -124,9 +132,9 @@ public BigTextEditDialog(JFrame owner, String text, String title) { gbc.insets = new Insets(0, 0, 0, 0); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; - gbc.gridwidth=3; + gbc.gridwidth = 3; gbc.gridy = 0; - JScrollPane editScrollPane=new JScrollPane(editTextArea); + JScrollPane editScrollPane = new JScrollPane(editTextArea); contentPane.add(editScrollPane, gbc); final JButton validateButton = new JButton("Valider"); @@ -145,12 +153,14 @@ public BigTextEditDialog(JFrame owner, String text, String title) { gbc.gridy = 1; contentPane.add(cancelButton, gbc); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - cancelButton.doClick(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + cancelButton.doClick(); + } } - }); + ); pack(); setLocationRelativeTo(owner); @@ -161,8 +171,8 @@ private void buttonCancel() { } private void buttonValidate() { - textResult=editTextArea.getText(); - setVisible(false); + textResult = editTextArea.getText(); + setVisible(false); } /** diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java index 4493e201..6fb4fada 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/CleanDialog.java @@ -108,7 +108,8 @@ public class CleanDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(CleanDialog.class); } @@ -133,7 +134,6 @@ public CleanDialog(MainWindow owner) { GridBagConstraints gbc; GridBagLayout gbl; - searchThread = null; technicalSearchThread = null; setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); @@ -144,8 +144,8 @@ public CleanDialog(MainWindow owner) { Container contentPane = getContentPane(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0, 0.1, 0.0, 0.0}; - gbl.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0}; + gbl.columnWeights = new double[] { 1.0, 0.1, 0.0, 0.0 }; + gbl.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 }; contentPane.setLayout(gbl); JButton searchButton = new JButton(); @@ -188,8 +188,8 @@ public CleanDialog(MainWindow owner) { previousButton.addActionListener(arg0 -> buttonPrevious()); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{0.0, 1.0}; - gbl.columnWidths = new int[]{30, 0}; + gbl.columnWeights = new double[] { 0.0, 1.0 }; + gbl.columnWidths = new int[] { 30, 0 }; JPanel choicePanel = new JPanel(gbl); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; @@ -328,9 +328,11 @@ public CleanDialog(MainWindow owner) { explanationTextArea.setFont(new JLabel().getFont()); explanationTextArea.setBackground(UIManager.getColor("Dialog.background")); explanationTextArea.setFocusable(false); - explanationTextArea.setText("Le nettoyage va éliminer des éléments jugés inutiles ou contraire à la construction de paquets SEDA corrects:\n\n" + - " - objet numériques de taille nulle: l'objet et ses métadonnées sont supprimés ainsi que le groupe d'objets si lui-même se retrouve vide,\n\n" + - " - unité d'archives sans descendance: l'unité d'archive qui n'a ni descendance en unité d'archives, ni objet (numérique ou physique) associé est supprimée avec toutes ses métadonnées."); + explanationTextArea.setText( + "Le nettoyage va éliminer des éléments jugés inutiles ou contraire à la construction de paquets SEDA corrects:\n\n" + + " - objet numériques de taille nulle: l'objet et ses métadonnées sont supprimés ainsi que le groupe d'objets si lui-même se retrouve vide,\n\n" + + " - unité d'archives sans descendance: l'unité d'archive qui n'a ni descendance en unité d'archives, ni objet (numérique ou physique) associé est supprimée avec toutes ses métadonnées." + ); explanationTextArea.setWrapStyleWord(true); gbc = new GridBagConstraints(); gbc.gridx = 1; @@ -347,12 +349,14 @@ public CleanDialog(MainWindow owner) { pack(); setLocationRelativeTo(owner); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - close(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } } - }); + ); } void changeChoice(ActionEvent e) { @@ -378,25 +382,35 @@ private void removeDataObjectGroup(ArchiveUnit archiveUnit) { archiveUnit.getDataObjectPackage().getDogInDataObjectPackageIdMap().remove(dog.getInDataObjectPackageId()); } - private boolean confirmCleanAll(int auCount, int bdoCount){ - return (UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Vous allez supprimer "+(auCount!=0?auCount+" unité"+(auCount>1?"s":"")+" d'archives":"")+ - (bdoCount!=0?bdoCount+" objet"+(bdoCount>1?"s":"")+" binaire"+(bdoCount>1?"s":""):"")+".\n" - + "Voulez-vous continuer?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) == OK_DIALOG); + private boolean confirmCleanAll(int auCount, int bdoCount) { + return ( + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Vous allez supprimer " + + (auCount != 0 ? auCount + " unité" + (auCount > 1 ? "s" : "") + " d'archives" : "") + + (bdoCount != 0 + ? bdoCount + " objet" + (bdoCount > 1 ? "s" : "") + " binaire" + (bdoCount > 1 ? "s" : "") + : "") + + ".\n" + + "Voulez-vous continuer?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) == + OK_DIALOG + ); } void doCleanAll() { if ((searchDataObjectResult != null) && (searchResultCount > 0)) { - if (!confirmCleanAll(0,searchResultCount)) - return; + if (!confirmCleanAll(0, searchResultCount)) return; for (Map.Entry> e : searchDataObjectResult.entrySet()) { for (BinaryDataObject bdo : e.getValue()) { removeDataObject(e.getKey(), bdo); DataObjectGroup dog = e.getKey().getTheDataObjectGroup(); - if (dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0) - removeDataObjectGroup(e.getKey()); + if ( + dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0 + ) removeDataObjectGroup(e.getKey()); } } searchResultCount = 0; @@ -407,9 +421,8 @@ void doCleanAll() { resultObjectLabel.setText(stepObjectInfo()); ResipGraphicApp.getTheWindow().treePane.doRefreshTree(); } else if ((searchArchiveUnitResult != null) && (searchArchiveUnitResult.size() > 0)) { - if (!confirmCleanAll(searchArchiveUnitResult.size(),0)) - return; - for (ArchiveUnit archiveUnit : searchArchiveUnitResult) { + if (!confirmCleanAll(searchArchiveUnitResult.size(), 0)) return; + for (ArchiveUnit archiveUnit : searchArchiveUnitResult) { archiveUnit.getDataObjectPackage().removeEmptyArchiveUnit(archiveUnit); } searchArchiveUnitResult = null; @@ -420,10 +433,14 @@ void doCleanAll() { void doCleanOne() { if ((searchDataObjectResult != null) && (searchResultCount > 0)) { - removeDataObject(searchCurrentArchiveUnit, searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + removeDataObject( + searchCurrentArchiveUnit, + searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); DataObjectGroup dog = searchCurrentArchiveUnit.getTheDataObjectGroup(); - if (dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0) - removeDataObjectGroup(searchCurrentArchiveUnit); + if ( + dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0 + ) removeDataObjectGroup(searchCurrentArchiveUnit); searchDataObjectResult.get(searchCurrentArchiveUnit).remove(searchObjectPosition); searchResultCount--; if (searchDataObjectResult.get(searchCurrentArchiveUnit).size() == 0) { @@ -445,25 +462,36 @@ void doCleanOne() { resultObjectLabel.setText(stepObjectInfo()); ResipGraphicApp.getTheWindow().treePane.doRefreshTree(); if (searchResultCount > 0) { - ResipGraphicApp.getTheWindow().treePane.focusDataObject(searchCurrentArchiveUnit, searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + ResipGraphicApp.getTheWindow() + .treePane.focusDataObject( + searchCurrentArchiveUnit, + searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); } } try { ResipGraphicApp.getTheWindow().auMetadataPane.editArchiveUnit(searchCurrentArchiveUnit); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} ResipGraphicApp.getTheApp().setModifiedContext(true); } else if ((searchArchiveUnitResult != null) && (searchArchiveUnitResult.size() > 0)) { - searchArchiveUnitResult.get(searchResultPosition).getDataObjectPackage().removeEmptyArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); + searchArchiveUnitResult + .get(searchResultPosition) + .getDataObjectPackage() + .removeEmptyArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); searchArchiveUnitResult.remove(searchResultPosition); searchResultPosition = Math.min(searchResultPosition, searchArchiveUnitResult.size() - 1); ResipGraphicApp.getTheWindow().treePane.doRefreshTree(); if (searchResultPosition >= 0) { - resultArchiveUnitLabel.setText((searchResultPosition + 1) + "/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); - ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); - } - else - resultArchiveUnitLabel.setText("0 trouvé"); + resultArchiveUnitLabel.setText( + (searchResultPosition + 1) + + "/" + + searchArchiveUnitResult.size() + + " trouvé" + + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); + ResipGraphicApp.getTheWindow() + .treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); + } else resultArchiveUnitLabel.setText("0 trouvé"); ResipGraphicApp.getTheApp().setModifiedContext(true); } } @@ -505,14 +533,26 @@ private void moreExplanationEvent(ItemEvent event) { private void buttonSearch() { if ((searchThread == null) && (technicalSearchThread == null)) { if (withoutChildArchiveUnitRadioButton.isSelected()) { - searchThread = new SearchThread(ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage().getGhostRootAu(), - true, true, - false, false, false, false, - "", e -> setSearchArchiveUnitResult(e)); + searchThread = new SearchThread( + ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage().getGhostRootAu(), + true, + true, + false, + false, + false, + false, + "", + e -> setSearchArchiveUnitResult(e) + ); searchThread.execute(); } else { - technicalSearchThread = new TechnicalSearchThread(ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage().getGhostRootAu(), - new ArrayList(), 0, 0, e -> setDataObjectSearchResult(e)); + technicalSearchThread = new TechnicalSearchThread( + ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage().getGhostRootAu(), + new ArrayList(), + 0, + 0, + e -> setDataObjectSearchResult(e) + ); technicalSearchThread.execute(); } resultArchiveUnitLabel.setText("En cours"); @@ -524,25 +564,39 @@ private void buttonSearch() { } private String stepArchiveUnitInfo() { - if (searchResultCount == 0) - return "0 trouvé"; - else - return "" + (searchArchiveUnitPosition + 1) + "/" + searchResultListCount + " AU trouvé" + - (searchResultCount > 1 ? "s" : ""); + if (searchResultCount == 0) return "0 trouvé"; + else return ( + "" + + (searchArchiveUnitPosition + 1) + + "/" + + searchResultListCount + + " AU trouvé" + + (searchResultCount > 1 ? "s" : "") + ); } private String stepObjectInfo() { - if (searchResultListCount == 0) - return ""; - else - return "" + (searchResultPosition + 1) + "/" + searchResultCount + - " obj. trouvé" + (searchResultCount > 1 ? "s" : ""); + if (searchResultListCount == 0) return ""; + else return ( + "" + + (searchResultPosition + 1) + + "/" + + searchResultCount + + " obj. trouvé" + + (searchResultCount > 1 ? "s" : "") + ); } private void buttonNext() { if (searchArchiveUnitResult != null && searchArchiveUnitResult.size() > 0) { searchResultPosition = Math.min(searchResultPosition + 1, searchArchiveUnitResult.size() - 1); - resultArchiveUnitLabel.setText((searchResultPosition + 1) + "/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + (searchResultPosition + 1) + + "/" + + searchArchiveUnitResult.size() + + " trouvé" + + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); } else if ((searchDataObjectResult != null) && (searchResultCount > 0)) { searchObjectPosition++; @@ -559,14 +613,24 @@ private void buttonNext() { } resultArchiveUnitLabel.setText(stepArchiveUnitInfo()); resultObjectLabel.setText(stepObjectInfo()); - ResipGraphicApp.getTheWindow().treePane.focusDataObject(searchCurrentArchiveUnit, searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + ResipGraphicApp.getTheWindow() + .treePane.focusDataObject( + searchCurrentArchiveUnit, + searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); } } private void buttonPrevious() { if (searchArchiveUnitResult != null && searchArchiveUnitResult.size() > 0) { searchResultPosition = Math.max(searchResultPosition - 1, 0); - resultArchiveUnitLabel.setText((searchResultPosition + 1) + "/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + (searchResultPosition + 1) + + "/" + + searchArchiveUnitResult.size() + + " trouvé" + + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); } else if ((searchDataObjectResult != null) && (searchResultCount > 0)) { searchObjectPosition--; @@ -583,7 +647,11 @@ private void buttonPrevious() { } resultArchiveUnitLabel.setText(stepArchiveUnitInfo()); resultObjectLabel.setText(stepObjectInfo()); - ResipGraphicApp.getTheWindow().treePane.focusDataObject(searchCurrentArchiveUnit, searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + ResipGraphicApp.getTheWindow() + .treePane.focusDataObject( + searchCurrentArchiveUnit, + searchDataObjectResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); } } @@ -596,10 +664,11 @@ public void setSearchArchiveUnitResult(List searchArchiveUnitResult this.searchArchiveUnitResult = searchArchiveUnitResult; searchResultPosition = 0; if (searchArchiveUnitResult.size() > 0) { - resultArchiveUnitLabel.setText("1/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + "1/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(0)); - } else - resultArchiveUnitLabel.setText("0 trouvé"); + } else resultArchiveUnitLabel.setText("0 trouvé"); searchThread = null; } @@ -620,7 +689,11 @@ public void setDataObjectSearchResult(LinkedHashMap buttonClose()); - - pack(); - setLocationRelativeTo(owner); - } - - // actions - - private void buttonClose() { - setVisible(false); - } - + // Dialog test context + + /** + * The entry point of dialog test. + * + * @param args the input arguments + * @throws ClassNotFoundException the class not found exception + * @throws UnsupportedLookAndFeelException the unsupported look and feel exception + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws NoSuchMethodException the no such method exception + * @throws InvocationTargetException the invocation target exception + */ + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + TestDialogWindow window = new TestDialogWindow(CreationContextDialog.class); + } + + /** + * Instantiates a new CreationContextDialog for test. + * + * @param owner the owner + */ + public CreationContextDialog(JFrame owner) { + this(owner, new DiskImportContext(Preferences.getInstance()), new DataObjectPackage()); + } + + /** + * Create the dialog. + * + * @param owner the owner + * @param creationContext the creation context + * @param dataObjectPackage the data object package + */ + public CreationContextDialog(JFrame owner, CreationContext creationContext, DataObjectPackage dataObjectPackage) { + super(owner, "Visualisation du contexte d'import", true); + GridBagConstraints gbc; + setMinimumSize(new Dimension(400, 200)); + setPreferredSize(new Dimension(700, 400)); + + Container contentPane = getContentPane(); + contentPane.setLayout(new GridBagLayout()); + + GridBagLayout gridBagLayout = new GridBagLayout(); + gridBagLayout.rowWeights = new double[] { 1.0, 0.0 }; + gridBagLayout.columnWeights = new double[] { 1.0 }; + contentPane.setLayout(gridBagLayout); + + // Parameters Panel + JPanel parametersPanel = new JPanel(); + GridBagLayout gbl_parametersPanel = new GridBagLayout(); + parametersPanel.setLayout(gbl_parametersPanel); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 0; + contentPane.add(parametersPanel, gbc); + + JLabel parametersLabel = new JLabel("Résumé :"); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 5, 5, 5); + gbc.anchor = GridBagConstraints.EAST; + gbc.gridx = 0; + gbc.gridy = 0; + parametersPanel.add(parametersLabel, gbc); + + JScrollPane scrollPane_1 = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 0); + gbc.gridx = 1; + gbc.gridy = 0; + parametersPanel.add(scrollPane_1, gbc); + + JTextArea importTypeTextArea = new JTextArea(); + importTypeTextArea.setFont(MainWindow.LABEL_FONT); + importTypeTextArea.setEditable(false); + scrollPane_1.setViewportView(importTypeTextArea); + importTypeTextArea.setText(creationContext.getActualisedSummary(dataObjectPackage)); + importTypeTextArea.setCaretPosition(0); + + if ((creationContext instanceof DiskImportContext) || (creationContext instanceof SIPImportContext)) { + JLabel workDirLabel = new JLabel("Répertoire de travail :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + parametersPanel.add(workDirLabel, gbc); + + JTextArea workDirTextArea = new JTextArea(2, 60); + workDirTextArea.setFont(MainWindow.LABEL_FONT); + workDirTextArea.setEditable(false); + workDirTextArea.setBorder(scrollPane_1.getBorder()); + workDirTextArea.setText(creationContext.getWorkDir()); + workDirTextArea.setCaretPosition(0); + workDirTextArea.setLineWrap(true); + gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 0); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 1; + parametersPanel.add(workDirTextArea, gbc); + workDirTextArea.setColumns(10); + + if (creationContext instanceof DiskImportContext) { + JScrollPane ignorePatternsSrollPane = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.fill = GridBagConstraints.BOTH; + gbc.gridheight = 2; + gbc.gridx = 1; + gbc.gridy = 2; + parametersPanel.add(ignorePatternsSrollPane, gbc); + + JTextArea ignorePatternsTextArea = new JTextArea(); + ignorePatternsTextArea.setFont(MainWindow.LABEL_FONT); + ignorePatternsTextArea.setEditable(false); + ignorePatternsTextArea.setCaretPosition(0); + ignorePatternsTextArea.setLineWrap(true); + ignorePatternsSrollPane.setViewportView(ignorePatternsTextArea); + + JLabel ignorePatternsLabel = new JLabel("Fichiers exclus des imports :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 0; + gbc.gridy = 2; + parametersPanel.add(ignorePatternsLabel, gbc); + + if (((DiskImportContext) creationContext).getIgnorePatternList() != null) { + StringBuilder sb = new StringBuilder(); + for (String p : ((DiskImportContext) creationContext).getIgnorePatternList()) { + sb.append(p).append('\n'); + } + ignorePatternsTextArea.setText(sb.toString().trim()); + } + } + } + // Buttons + JButton cancelButton = new JButton("Fermer"); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + contentPane.add(cancelButton, gbc); + cancelButton.addActionListener(arg -> buttonClose()); + + pack(); + setLocationRelativeTo(owner); + } + + // actions + + private void buttonClose() { + setVisible(false); + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java index 9cda8e7a..6f7839aa 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/DuplicatesWindow.java @@ -38,9 +38,9 @@ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; +import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.*; import fr.gouv.vitam.tools.resip.threads.DuplicatesThread; import fr.gouv.vitam.tools.resip.utils.ResipException; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.*; import fr.gouv.vitam.tools.sedalib.core.*; import fr.gouv.vitam.tools.sedalib.metadata.data.FileInfo; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; @@ -51,10 +51,9 @@ import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.io.File; import java.lang.reflect.InvocationTargetException; -import java.util.List; import java.util.*; +import java.util.List; /** * The class DuplicatesWindow. @@ -105,7 +104,8 @@ public class DuplicatesWindow extends JFrame { * @throws ResipException the resip exception * @throws InterruptedException the interrupted exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); @@ -387,18 +387,17 @@ public DuplicatesWindow() { duplicatesTable.setAutoCreateRowSorter(true); duplicatesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); duplicatesTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderCellRenderer()); - duplicatesTable.getColumnModel().getColumn(0) - .setPreferredWidth(20); - duplicatesTable.getColumnModel().getColumn(1) - .setPreferredWidth(20); - duplicatesTable.getColumnModel().getColumn(2) - .setPreferredWidth(20); + duplicatesTable.getColumnModel().getColumn(0).setPreferredWidth(20); + duplicatesTable.getColumnModel().getColumn(1).setPreferredWidth(20); + duplicatesTable.getColumnModel().getColumn(2).setPreferredWidth(20); ListSelectionModel selectionModel = duplicatesTable.getSelectionModel(); - selectionModel.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - handleDuplicatesSelectionEvent(e); + selectionModel.addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + handleDuplicatesSelectionEvent(e); + } } - }); + ); scrollPane.setViewportView(duplicatesTable); final JPanel deduplicateActionPanel = new JPanel(); @@ -443,7 +442,6 @@ public void valueChanged(ListSelectionEvent e) { gbc.insets = new Insets(5, 5, 5, 5); deduplicateActionPanel.add(placeHolder, gbc); - explanationPanel = new JPanel(); explanationPanel.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); @@ -472,12 +470,14 @@ public void valueChanged(ListSelectionEvent e) { explanationTextArea.setFont(new JLabel().getFont()); explanationTextArea.setBackground(UIManager.getColor("Dialog.background")); explanationTextArea.setFocusable(false); - explanationTextArea.setText("La recherche se fait sur :\n" + - "- l'ensemble des formats fournis, selon les choix cochés, par:\n" + - " - une catégorie de fichiers, déterminant une liste de PUID Pronom,\n" + - " - une liste libre de PUID Pronom séparés par des virgules (par exemple: x-fmt/111, fmt/101)\n" + - " En cliquant sur le bouton de mise à jour, on peut voir la liste de l'ensemble des formats pris en compte.\n" + - "- la taille du fichier."); + explanationTextArea.setText( + "La recherche se fait sur :\n" + + "- l'ensemble des formats fournis, selon les choix cochés, par:\n" + + " - une catégorie de fichiers, déterminant une liste de PUID Pronom,\n" + + " - une liste libre de PUID Pronom séparés par des virgules (par exemple: x-fmt/111, fmt/101)\n" + + " En cliquant sur le bouton de mise à jour, on peut voir la liste de l'ensemble des formats pris en compte.\n" + + "- la taille du fichier." + ); explanationTextArea.setWrapStyleWord(true); gbc = new GridBagConstraints(); gbc.gridx = 1; @@ -501,12 +501,14 @@ public void valueChanged(ListSelectionEvent e) { dogListPosition = 0; auListPosition = 0; - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - close(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } } - }); + ); } // actions @@ -526,23 +528,27 @@ private void meldLine(int line) { List originBdoList = dogList.get(0).getBinaryDataObjectList(); // meld using existing DOGs List newDogList = new ArrayList(); - int afterMeldDOGNumber = (int) Math.ceil((double) auList.size() / (double) ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()); - if (dogList.size() <= afterMeldDOGNumber) - return; + int afterMeldDOGNumber = (int) Math.ceil( + (double) auList.size() / (double) ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + ); + if (dogList.size() <= afterMeldDOGNumber) return; for (int i = 0; i < afterMeldDOGNumber; i++) { DataObjectGroup dog = dogList.get(i); newDogList.add(dog); List bdoList = dog.getBinaryDataObjectList(); for (int j = 0; j < originBdoList.size(); j++) { - FileInfo bdoFIleInfo=bdoList.get(j).getMetadataFileInfo(); - FileInfo originBdoFIleInfo=originBdoList.get(j).getMetadataFileInfo(); + FileInfo bdoFIleInfo = bdoList.get(j).getMetadataFileInfo(); + FileInfo originBdoFIleInfo = originBdoList.get(j).getMetadataFileInfo(); try { bdoFIleInfo.addNewMetadata("Filename", originBdoFIleInfo.getSimpleMetadata("Filename")); bdoFIleInfo.addNewMetadata("LastModified", originBdoFIleInfo.getSimpleMetadata("LastModified")); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } - for (int j = i * ResipGraphicApp.getTheApp().treatmentParameters.getDupMax(); j < Math.min((i + 1) * ResipGraphicApp.getTheApp().treatmentParameters.getDupMax(), auList.size()); j++) { + for ( + int j = i * ResipGraphicApp.getTheApp().treatmentParameters.getDupMax(); + j < Math.min((i + 1) * ResipGraphicApp.getTheApp().treatmentParameters.getDupMax(), auList.size()); + j++ + ) { ArchiveUnit au = auList.get(j); DataObjectRefList dorl = new DataObjectRefList(au.getDataObjectPackage()); dorl.add(dog); @@ -566,29 +572,52 @@ private void meldLine(int line) { private void refreshGraphic() { mainWindow.treePane.doRefreshTree(); duplicatesTable.repaint(); - if (dogList != null) - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + if (dogList != null) lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); } private void buttonLineMelt() { if (auList.size() > ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()) { if ((auList.size() / ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()) + 1 >= dogList.size()) { - UserInteractionDialog.getUserAnswer(mainWindow, - "Ce lot de doublons représente un groupe d'objets référencé par " + auList.size() + " ArchiveUnit.\n" - + "La fusion peut être faite au plus par lots de " + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + " ArchiveUnit. Il n'est pas possible de fusionner plus.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + mainWindow, + "Ce lot de doublons représente un groupe d'objets référencé par " + + auList.size() + + " ArchiveUnit.\n" + + "La fusion peut être faite au plus par lots de " + + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + + " ArchiveUnit. Il n'est pas possible de fusionner plus.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return; - } else UserInteractionDialog.getUserAnswer(mainWindow, - "Ce lot de doublons représente un groupe d'objets référencé par " + auList.size() + " ArchiveUnit.\n" - + "La fusion sera faite par lots de " + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + " ArchiveUnit au plus.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + } else UserInteractionDialog.getUserAnswer( + mainWindow, + "Ce lot de doublons représente un groupe d'objets référencé par " + + auList.size() + + " ArchiveUnit.\n" + + "La fusion sera faite par lots de " + + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + + " ArchiveUnit au plus.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); } - int selectedRow = duplicatesTable - .convertRowIndexToModel(duplicatesTable.getSelectionModel().getMinSelectionIndex()); + int selectedRow = duplicatesTable.convertRowIndexToModel( + duplicatesTable.getSelectionModel().getMinSelectionIndex() + ); meldLine(selectedRow); dogList = ((DuplicatesTableModel) duplicatesTable.getModel()).getRowDogList(selectedRow); dogListPosition = 0; @@ -604,44 +633,56 @@ private void buttonAllMelt() { List localAuList = dtm.getRowAuList(i); List localDogList = dtm.getRowDogList(i); if (localAuList.size() > ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()) { - if ((localAuList.size() / ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()) + 1 >= localDogList.size()) - cantMeltMore++; - else - moreThanDuplicatesLimit++; + if ( + (localAuList.size() / ResipGraphicApp.getTheApp().treatmentParameters.getDupMax()) + 1 >= + localDogList.size() + ) cantMeltMore++; + else moreThanDuplicatesLimit++; } } if ((moreThanDuplicatesLimit > 0) || (cantMeltMore > 0)) { String message = "Dans l'ensemble:"; - if (moreThanDuplicatesLimit > 0) - message += "\n - " + moreThanDuplicatesLimit + " ligne" + (moreThanDuplicatesLimit > 1 ? "s ont" : " a") - + " plus de doublons que la taille maximale de fusion [" + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() - + "]. La fusion sera donc faite en plusieurs lots."; - if (cantMeltMore > 0) - message += "\n - " + cantMeltMore + " ligne" + (cantMeltMore > 1 ? "s ont" : " a") - + " plus de doublons que la taille maximale de fusion [" + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() - + "], mais " + (cantMeltMore > 1 ? "ont" : "a") + " déjà été fusionnée" + (cantMeltMore > 1 ? "s" : "") - + " au maximum."; - UserInteractionDialog.getUserAnswer(mainWindow, message, "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + if (moreThanDuplicatesLimit > 0) message += + "\n - " + + moreThanDuplicatesLimit + + " ligne" + + (moreThanDuplicatesLimit > 1 ? "s ont" : " a") + + " plus de doublons que la taille maximale de fusion [" + + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + + "]. La fusion sera donc faite en plusieurs lots."; + if (cantMeltMore > 0) message += + "\n - " + + cantMeltMore + + " ligne" + + (cantMeltMore > 1 ? "s ont" : " a") + + " plus de doublons que la taille maximale de fusion [" + + ResipGraphicApp.getTheApp().treatmentParameters.getDupMax() + + "], mais " + + (cantMeltMore > 1 ? "ont" : "a") + + " déjà été fusionnée" + + (cantMeltMore > 1 ? "s" : "") + + " au maximum."; + UserInteractionDialog.getUserAnswer( + mainWindow, + message, + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); } - int selectedindex = duplicatesTable.getSelectionModel().getMinSelectionIndex(); int selectedRow = -1; - if (selectedindex >= 0) - selectedRow = duplicatesTable.convertRowIndexToModel(selectedindex); - for (int i = 0; i < dtm.getRowCount(); i++) - meldLine(i); - if (selectedRow >= 0) - dogList = dtm.getRowDogList(selectedRow); + if (selectedindex >= 0) selectedRow = duplicatesTable.convertRowIndexToModel(selectedindex); + for (int i = 0; i < dtm.getRowCount(); i++) meldLine(i); + if (selectedRow >= 0) dogList = dtm.getRowDogList(selectedRow); dogListPosition = 0; auListPosition = 0; refreshGraphic(); } private void handleDuplicatesSelectionEvent(ListSelectionEvent e) { - if (e.getValueIsAdjusting()) - return; + if (e.getValueIsAdjusting()) return; final DefaultListSelectionModel target = (DefaultListSelectionModel) e.getSource(); int selectedIndex = target.getMinSelectionIndex(); @@ -655,13 +696,22 @@ private void handleDuplicatesSelectionEvent(ListSelectionEvent e) { auList = model.getRowAuList(duplicatesTable.convertRowIndexToModel(selectedIndex)); dogListPosition = 0; auListPosition = 0; - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); lineDedupButton.setEnabled(true); mainWindow.treePane.focusDataObjectGroup(dogList.get(dogListPosition)); } -/* private DataObjectPackageTreeNode focusNode(DataObjectGroup dog) { + /* private DataObjectPackageTreeNode focusNode(DataObjectGroup dog) { DataObjectPackageTreeNode focusNode = dataObjectPackageTreeModel.findTreeNode(dog); TreePath path = new TreePath(dataObjectPackageTreeModel.getPathToRoot(focusNode)); @@ -701,9 +751,12 @@ private void buttonSearch() { if (duplicatesThread == null) { emptyDialog(); globalResultLabel.setText("En cours"); - duplicatesThread = new DuplicatesThread(this, binaryHashCheckBox.isSelected(), - binaryFilenameCheckBox.isSelected(), - physicalAllMDCheckBox.isSelected()); + duplicatesThread = new DuplicatesThread( + this, + binaryHashCheckBox.isSelected(), + binaryFilenameCheckBox.isSelected(), + physicalAllMDCheckBox.isSelected() + ); duplicatesThread.execute(); } } @@ -713,14 +766,22 @@ private DataObjectGroup getDog(ArchiveUnit au) { return (DataObjectGroup) dataObject; } - private void buttonNextAU() { if ((auList != null) && (auListPosition < auList.size() - 1)) { auListPosition++; - if (!getDog(auList.get(auListPosition - 1)).equals(getDog(auList.get(auListPosition)))) - dogListPosition = dogList.indexOf(getDog(auList.get(auListPosition))); - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + if (!getDog(auList.get(auListPosition - 1)).equals(getDog(auList.get(auListPosition)))) dogListPosition = + dogList.indexOf(getDog(auList.get(auListPosition))); + lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); mainWindow.treePane.focusArchiveUnit(auList.get(auListPosition)); } } @@ -728,10 +789,19 @@ private void buttonNextAU() { private void buttonPreviousAU() { if ((auList != null) && (auListPosition > 0)) { auListPosition--; - if (!getDog(auList.get(auListPosition + 1)).equals(getDog(auList.get(auListPosition)))) - dogListPosition = dogList.indexOf(getDog(auList.get(auListPosition))); - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + if (!getDog(auList.get(auListPosition + 1)).equals(getDog(auList.get(auListPosition)))) dogListPosition = + dogList.indexOf(getDog(auList.get(auListPosition))); + lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); mainWindow.treePane.focusArchiveUnit(auList.get(auListPosition)); } } @@ -739,20 +809,42 @@ private void buttonPreviousAU() { private void buttonNextDOG() { if ((dogList != null) && (dogListPosition < dogList.size() - 1)) { dogListPosition++; - DataObjectPackageTreeNode parentNode = mainWindow.treePane.focusDataObjectGroup(dogList.get(dogListPosition)); + DataObjectPackageTreeNode parentNode = mainWindow.treePane.focusDataObjectGroup( + dogList.get(dogListPosition) + ); auListPosition = auList.indexOf(parentNode.getArchiveUnit()); - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); } } private void buttonPreviousDOG() { if ((dogList != null) && (dogListPosition > 0)) { dogListPosition--; - DataObjectPackageTreeNode parentNode = mainWindow.treePane.focusDataObjectGroup(dogList.get(dogListPosition)); + DataObjectPackageTreeNode parentNode = mainWindow.treePane.focusDataObjectGroup( + dogList.get(dogListPosition) + ); auListPosition = auList.indexOf(parentNode.getArchiveUnit()); - lineResultLabel.setText("rang " + (dogListPosition + 1) + "/" + dogList.size() + " DOG et " - + (auListPosition + 1) + "/" + auList.size() + " AU sur la ligne"); + lineResultLabel.setText( + "rang " + + (dogListPosition + 1) + + "/" + + dogList.size() + + " DOG et " + + (auListPosition + 1) + + "/" + + auList.size() + + " AU sur la ligne" + ); } } @@ -762,8 +854,10 @@ private void buttonPreviousDOG() { * @param dogByDigestMap the dog by digest map * @param auByDigestMap the au by digest map */ - public void setDuplicatesResult(LinkedHashMap> dogByDigestMap, - HashMap> auByDigestMap) { + public void setDuplicatesResult( + LinkedHashMap> dogByDigestMap, + HashMap> auByDigestMap + ) { ((DuplicatesTableModel) duplicatesTable.getModel()).setData(dogByDigestMap, auByDigestMap); DuplicatesTableModel dtm = ((DuplicatesTableModel) (duplicatesTable.getModel())); @@ -771,17 +865,17 @@ public void setDuplicatesResult(LinkedHashMap> dog dtm.fireTableDataChanged(); duplicatesTable.getRowSorter().toggleSortOrder(1); duplicatesTable.getRowSorter().toggleSortOrder(1); - duplicatesTable.getColumnModel().getColumn(0) - .setPreferredWidth(20); - duplicatesTable.getColumnModel().getColumn(1) - .setPreferredWidth(20); - if (auByDigestMap.size() == 0) - globalResultLabel.setText("0 lots de DOG doublons/0 AU"); - else - globalResultLabel.setText("" + dogByDigestMap.size() + " lots de DOG doublons/" + - auByDigestMap.entrySet().stream().map(arg -> arg.getValue().size()).reduce(Integer::sum).get() + " AU"); - if (dogByDigestMap.size() > 0) - allDedupButton.setEnabled(true); + duplicatesTable.getColumnModel().getColumn(0).setPreferredWidth(20); + duplicatesTable.getColumnModel().getColumn(1).setPreferredWidth(20); + if (auByDigestMap.size() == 0) globalResultLabel.setText("0 lots de DOG doublons/0 AU"); + else globalResultLabel.setText( + "" + + dogByDigestMap.size() + + " lots de DOG doublons/" + + auByDigestMap.entrySet().stream().map(arg -> arg.getValue().size()).reduce(Integer::sum).get() + + " AU" + ); + if (dogByDigestMap.size() > 0) allDedupButton.setEnabled(true); dogList = null; auList = null; dogListPosition = 0; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java index 0d0e3397..3fe3d078 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ExportContextDialog.java @@ -62,784 +62,810 @@ */ public class ExportContextDialog extends JDialog { - /** - * The actions components. - */ - private JTabbedPane tabbedPane; - - private JTextField messageIdentifierTextField; - private JTextField dateTextField; - private JCheckBox chckbxNowFlag; - private JTextArea commentTextArea; - private JTextField archivalAgreementTextField; - private JTextField archivalAgencyIdentifierTextField; - private JTextField transferringAgencyIdentifierTextField; - - private JTextArea clvTextArea; - private JTextArea managementMetadataTextArea; - private JTextField transferRequestReplyIdentifierTextField; - private JTextArea archivalAgencyOrganizationDescriptiveMetadataTextArea; - private JTextArea transferringAgencyOrganizationDescriptiveMetadataTextArea; - - private JRadioButton hierarchicalRadioButton; - private JRadioButton indentedRadioButton; - private JRadioButton reindexYesRadioButton; - private JRadioButton firstUsageButton; - private JRadioButton lastUsageButton; - private JRadioButton allUsageButton; - private JTextField nameMaxSizeTextField; - private JCheckBox csvExtendedFormatChexBox; - private JTextArea metadataFilterTextArea; - private JCheckBox metadataFilterCheckBox; - - /** - * The data. - */ - public transient ExportContext gmc; - - /** - * The return value. - */ - private int returnValue; - - // Dialog test context - - /** - * The entry point of dialog test. - * - * @param args the input arguments - * @throws ClassNotFoundException the class not found exception - * @throws UnsupportedLookAndFeelException the unsupported look and feel exception - * @throws InstantiationException the instantiation exception - * @throws IllegalAccessException the illegal access exception - * @throws NoSuchMethodException the no such method exception - * @throws InvocationTargetException the invocation target exception - */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - TestDialogWindow window = new TestDialogWindow(ExportContextDialog.class); - } - - /** - * Instantiates a new ExportContextDialog for test. - * - * @param owner the owner - */ - public ExportContextDialog(JFrame owner) { - this(owner, new ExportContext(Preferences.getInstance())); - } - - /** - * Create the dialog. - * - * @param owner the owner - * @param exportContext the sec - */ - public ExportContextDialog(JFrame owner, ExportContext exportContext) { - super(owner, "Edition des informations utiles à la création du manifest", true); - GridBagConstraints gbc; - - this.setPreferredSize(new Dimension(800, 500)); - this.setMinimumSize(new Dimension(500, 300)); - - Container contentPane = getContentPane(); - GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.rowWeights = new double[]{1.0, 0.1}; - gridBagLayout.columnWeights = new double[]{1.0, 1.0}; - contentPane.setLayout(new GridBagLayout()); - - tabbedPane = new JTabbedPane(SwingConstants.TOP); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.weightx=1.0; - gbc.weighty=1.0; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 0; - contentPane.add(tabbedPane, gbc); - - // header and footer simple fields - JPanel headerFooterSimplePanel = new JPanel(); - tabbedPane.addTab("Métadonnées globales", new ImageIcon(getClass().getResource("/icon/document-properties.png")), headerFooterSimplePanel, null); - GridBagLayout gblHeaderFooterSimplePanel = new GridBagLayout(); - gblHeaderFooterSimplePanel.columnWidths = new int[]{0, 0, 0}; - gblHeaderFooterSimplePanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; - gblHeaderFooterSimplePanel.columnWeights = new double[]{0.0, 1.0, 0.0}; - gblHeaderFooterSimplePanel.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; - headerFooterSimplePanel.setLayout(gblHeaderFooterSimplePanel); - - JLabel presentationLabel = new JLabel("Champs globaux du SIP"); - presentationLabel.setFont(MainWindow.BOLD_LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.gridwidth = 3; - gbc.insets = new Insets(0, 0, 5, 0); - gbc.weightx = 1.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 0; - gbc.gridy = 0; - gbc.insets = new Insets(5, 5, 5, 5); - headerFooterSimplePanel.add(presentationLabel, gbc); - - JLabel messageIdentifierLabel = new JLabel("Identifiant du message :"); - messageIdentifierLabel.setToolTipText("MessageIdentifier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 1; - headerFooterSimplePanel.add(messageIdentifierLabel, gbc); - - messageIdentifierTextField = new JTextField(); - messageIdentifierTextField.setText(exportContext.getArchiveTransferGlobalMetadata().messageIdentifier); - messageIdentifierTextField.setFont(MainWindow.DETAILS_FONT); - gbc = new GridBagConstraints(); - gbc.weightx = 1.0; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 1; - headerFooterSimplePanel.add(messageIdentifierTextField, gbc); - messageIdentifierTextField.setColumns(10); - - JLabel dateLabel = new JLabel("Date :"); - dateLabel.setToolTipText("ISO 8601"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 2; - headerFooterSimplePanel.add(dateLabel, gbc); - - dateTextField = new JTextField(); - dateTextField.setText(exportContext.getArchiveTransferGlobalMetadata().date); - dateTextField.setFont(MainWindow.DETAILS_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 2; - headerFooterSimplePanel.add(dateTextField, gbc); - dateTextField.setColumns(10); - - chckbxNowFlag = new JCheckBox("du jour"); - chckbxNowFlag.setSelected(exportContext.getArchiveTransferGlobalMetadata().isNowFlag()); - chckbxNowFlag.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 2; - gbc.gridy = 2; - headerFooterSimplePanel.add(chckbxNowFlag, gbc); - - JLabel lblComment = new JLabel("Commentaire :"); - lblComment.setToolTipText("Comment"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 3; - headerFooterSimplePanel.add(lblComment, gbc); - - JScrollPane scrollPane = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 3; - headerFooterSimplePanel.add(scrollPane, gbc); - - commentTextArea = new JTextArea(); - commentTextArea.setLineWrap(true); - commentTextArea.setWrapStyleWord(true); - commentTextArea.setCaretPosition(0); - scrollPane.setViewportView(commentTextArea); - commentTextArea.setText(exportContext.getArchiveTransferGlobalMetadata().comment); - commentTextArea.setFont(MainWindow.DETAILS_FONT); - - JLabel lblArchivalagreement = new JLabel("Identifiant du contrat d'entrée :"); - lblArchivalagreement.setToolTipText("ArchivalAgreement"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 4; - headerFooterSimplePanel.add(lblArchivalagreement, gbc); - - archivalAgreementTextField = new JTextField(); - archivalAgreementTextField.setText(exportContext.getArchiveTransferGlobalMetadata().archivalAgreement); - archivalAgreementTextField.setFont(MainWindow.DETAILS_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 4; - headerFooterSimplePanel.add(archivalAgreementTextField, gbc); - archivalAgreementTextField.setColumns(10); - - JLabel lblArchivalAgencyIdentifier = new JLabel("Service d'archivage :"); - lblArchivalAgencyIdentifier.setToolTipText("ArchivalAgency.Identifier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 5; - headerFooterSimplePanel.add(lblArchivalAgencyIdentifier, gbc); - - archivalAgencyIdentifierTextField = new JTextField(); - archivalAgencyIdentifierTextField.setText(exportContext.getArchiveTransferGlobalMetadata().archivalAgencyIdentifier); - archivalAgencyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 5; - headerFooterSimplePanel.add(archivalAgencyIdentifierTextField, gbc); - archivalAgencyIdentifierTextField.setColumns(10); - - JLabel lblTransferringAgencyIdentifier = new JLabel("Service versant :"); - lblTransferringAgencyIdentifier.setToolTipText("TransferringAgency.Identifier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 6; - headerFooterSimplePanel.add(lblTransferringAgencyIdentifier, gbc); - - transferringAgencyIdentifierTextField = new JTextField(); - transferringAgencyIdentifierTextField.setText(exportContext.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier); - transferringAgencyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 6; - headerFooterSimplePanel.add(transferringAgencyIdentifierTextField, gbc); - transferringAgencyIdentifierTextField.setColumns(10); - - // Header and footer complex fields - JPanel headerFooterComplexPanel = new JPanel(); - tabbedPane.addTab("Métadonnées globales étendues", new ImageIcon(getClass().getResource("/icon/text-x-generic.png")), headerFooterComplexPanel, null); - GridBagLayout gblHeaderFooterComplexPanel = new GridBagLayout(); - gblHeaderFooterComplexPanel.columnWidths = new int[]{0, 0, 0}; - gblHeaderFooterComplexPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0}; - gblHeaderFooterComplexPanel.columnWeights = new double[]{0.0, 1.0, 0.0}; - gblHeaderFooterComplexPanel.rowWeights = new double[]{0.0, 1.0, 1.0, 0.0, 0.5, 0.5, 0.0}; - headerFooterComplexPanel.setLayout(gblHeaderFooterComplexPanel); - - JLabel presentationComplexLabel = new JLabel("Champs globaux étendus du SIP"); - presentationComplexLabel.setFont(MainWindow.BOLD_LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.gridwidth = 3; - gbc.insets = new Insets(5, 5, 5, 5); - gbc.weightx = 1.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 0; - gbc.gridy = 0; - headerFooterComplexPanel.add(presentationComplexLabel, gbc); - - JLabel clvLabel = new JLabel("Liste des codes :"); - clvLabel.setToolTipText("Bloc XML CodeListVersions"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 1; - headerFooterComplexPanel.add(clvLabel, gbc); - - JScrollPane scrollPane1 = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 1; - headerFooterComplexPanel.add(scrollPane1, gbc); - - clvTextArea = new JTextArea(); - clvTextArea.setFont(MainWindow.DETAILS_FONT); - scrollPane1.setViewportView(clvTextArea); - clvTextArea.setText(exportContext.getArchiveTransferGlobalMetadata().codeListVersionsXmlData); - clvTextArea.setCaretPosition(0); - - JLabel managementMetadataLabel = new JLabel("Métadonnées de gestion globales :"); - managementMetadataLabel.setToolTipText("Bloc XML ManagementMetadata"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 2; - headerFooterComplexPanel.add(managementMetadataLabel, gbc); - - JScrollPane scrollPane2 = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 2; - headerFooterComplexPanel.add(scrollPane2, gbc); - - managementMetadataTextArea = new JTextArea(); - managementMetadataTextArea.setFont(MainWindow.DETAILS_FONT); - scrollPane2.setViewportView(managementMetadataTextArea); - managementMetadataTextArea.setText(exportContext.getManagementMetadataXmlData()); - managementMetadataTextArea.setCaretPosition(0); - - JLabel lblTransferRequestReplyIdentifier = new JLabel("Identifiant de réponse de transfert :"); - lblTransferRequestReplyIdentifier.setToolTipText("Valeur de TransferRequestReplyIdentifier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 3; - headerFooterComplexPanel.add(lblTransferRequestReplyIdentifier, gbc); - - transferRequestReplyIdentifierTextField = new JTextField(); - transferRequestReplyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); - transferRequestReplyIdentifierTextField.setText(exportContext.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 3; - headerFooterComplexPanel.add(transferRequestReplyIdentifierTextField, - gbc); - transferRequestReplyIdentifierTextField.setColumns(10); - - JLabel archivalAgencyOrganizationDescriptiveMetadataLabel = new JLabel("Détails sur l'acteur d'archivage :"); - archivalAgencyOrganizationDescriptiveMetadataLabel.setToolTipText("Bloc XML OrganisationDescriptiveMetadata de la métadonnée ArchivalAgency "); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 4; - headerFooterComplexPanel.add(archivalAgencyOrganizationDescriptiveMetadataLabel, - gbc); - - JScrollPane scrollPane3 = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 4; - headerFooterComplexPanel.add(scrollPane3, gbc); - - archivalAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); - archivalAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); - scrollPane3.setViewportView(archivalAgencyOrganizationDescriptiveMetadataTextArea); - archivalAgencyOrganizationDescriptiveMetadataTextArea - .setText(exportContext.getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData); - archivalAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); - - JLabel transferringAgencyOrganizationDescriptiveMetadataLabel = new JLabel("Détails sur l'acteur de transfert :"); - transferringAgencyOrganizationDescriptiveMetadataLabel.setToolTipText("Bloc XML OrganisationDescriptiveMetadata de la métadonnée TransferringAgency "); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 5; - headerFooterComplexPanel.add(transferringAgencyOrganizationDescriptiveMetadataLabel, - gbc); - - JScrollPane scrollPane4 = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = 2; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 5; - headerFooterComplexPanel.add(scrollPane4, gbc); - - transferringAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); - transferringAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); - scrollPane4.setViewportView(transferringAgencyOrganizationDescriptiveMetadataTextArea); - transferringAgencyOrganizationDescriptiveMetadataTextArea - .setText(exportContext.getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData); - transferringAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); - - // ExportParameters Panel - - JPanel exportParametersPanel = new JPanel(); - tabbedPane.addTab("Export", new ImageIcon(getClass().getResource("/icon/document-save.png")), exportParametersPanel, null); - GridBagLayout gblExportParametersPanel = new GridBagLayout(); - gblExportParametersPanel.columnWeights = new double[]{0.1, 0.1, 0.5, 0.1}; - gblExportParametersPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0}; - gblExportParametersPanel.rowWeights = new double[]{0, 0, 0, 0,0,0,0,0,0,1}; - exportParametersPanel.setLayout(gblExportParametersPanel); - - JLabel inSIPLabel = new JLabel("Options de formation du SIP"); - inSIPLabel.setFont(MainWindow.BOLD_LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.gridwidth = 3; - gbc.insets = new Insets(5, 5, 5, 5); - gbc.weightx = 1.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 0; - gbc.gridy = 0; - exportParametersPanel.add(inSIPLabel, gbc); - - JLabel hierarchicalAULabel = new JLabel("Export des AU dans le SIP:"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 1; - exportParametersPanel.add(hierarchicalAULabel, gbc); - - JRadioButton flatRadioButton = new JRadioButton("A plat"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 2; - gbc.gridy = 1; - exportParametersPanel.add(flatRadioButton, gbc); - - hierarchicalRadioButton = new JRadioButton("Imbriquées"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 1; - exportParametersPanel.add(hierarchicalRadioButton, gbc); - - ButtonGroup hierarchicalAUButtonGroup = new ButtonGroup(); - hierarchicalAUButtonGroup.add(flatRadioButton); - hierarchicalAUButtonGroup.add(hierarchicalRadioButton); - hierarchicalAUButtonGroup.clearSelection(); - if (exportContext.isHierarchicalArchiveUnits()) - hierarchicalRadioButton.setSelected(true); - else - flatRadioButton.setSelected(true); - - JLabel xmlPresentationLabel = new JLabel("Présentation XML dans le SIP:"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 0; - gbc.gridy = 2; - exportParametersPanel.add(xmlPresentationLabel, gbc); - - JRadioButton linearRadioButton = new JRadioButton("Linéaire"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 2; - gbc.gridy = 2; - exportParametersPanel.add(linearRadioButton, gbc); - - indentedRadioButton = new JRadioButton("Indentée"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.gridx = 1; - gbc.gridy = 2; - exportParametersPanel.add(indentedRadioButton, gbc); - - ButtonGroup indentedButtonGroup = new ButtonGroup(); - indentedButtonGroup.add(linearRadioButton); - indentedButtonGroup.add(indentedRadioButton); - indentedButtonGroup.clearSelection(); - if (exportContext.isIndented()) - indentedRadioButton.setSelected(true); - else - linearRadioButton.setSelected(true); - - JLabel xmlReindexLabel = new JLabel("Renumérotation des éléments XML avant export:"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 0; - gbc.gridy = 3; - exportParametersPanel.add(xmlReindexLabel, gbc); - - reindexYesRadioButton = new JRadioButton("Oui"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 1; - gbc.gridy = 3; - exportParametersPanel.add(reindexYesRadioButton, gbc); - - JRadioButton reindexNoRadioButton = new JRadioButton("Non"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.gridx = 2; - gbc.gridy = 3; - exportParametersPanel.add(reindexNoRadioButton, gbc); - - ButtonGroup reindexButtonGroup = new ButtonGroup(); - reindexButtonGroup.add(reindexYesRadioButton); - reindexButtonGroup.add(reindexNoRadioButton); - reindexButtonGroup.clearSelection(); - if (exportContext.isReindex()) - reindexYesRadioButton.setSelected(true); - else - reindexNoRadioButton.setSelected(true); - - JLabel inCSVLabel = new JLabel("Options d'export en hiérarchie simplifiée et fichier csv"); - inCSVLabel.setFont(MainWindow.BOLD_LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.gridwidth = 3; - gbc.insets = new Insets(5, 5, 5, 5); - gbc.weightx = 1.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 0; - gbc.gridy = 4; - exportParametersPanel.add(inCSVLabel, gbc); - - JLabel exportModeChoiceLabel = new JLabel("Mode de choix des objets exportés:"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 5; - exportParametersPanel.add(exportModeChoiceLabel, gbc); - - firstUsageButton = new JRadioButton("Premier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 5; - exportParametersPanel.add(firstUsageButton, gbc); - - lastUsageButton = new JRadioButton("Dernier"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 2; - gbc.gridy = 5; - exportParametersPanel.add(lastUsageButton, gbc); - - allUsageButton = new JRadioButton("Tous"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 3; - gbc.gridy = 5; - exportParametersPanel.add(allUsageButton, gbc); - - ButtonGroup exportModeChoiceButtonGroup = new ButtonGroup(); - exportModeChoiceButtonGroup.add(firstUsageButton); - exportModeChoiceButtonGroup.add(lastUsageButton); - exportModeChoiceButtonGroup.add(allUsageButton); - exportModeChoiceButtonGroup.clearSelection(); - switch (exportContext.getUsageVersionSelectionMode()) { - case FIRST_DATAOBJECT: - firstUsageButton.setSelected(true); - break; - case ALL_DATAOBJECTS: - allUsageButton.setSelected(true); - break; - case LAST_DATAOBJECT: - default: - lastUsageButton.setSelected(true); - break; - } - - JLabel lblNameMaxSize = new JLabel("Taille max des noms de répertoires :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 6; - exportParametersPanel.add(lblNameMaxSize, gbc); - - nameMaxSizeTextField = new JTextField(); - DocumentFilter filter = new NumericFilter(); - ((AbstractDocument) nameMaxSizeTextField.getDocument()).setDocumentFilter(filter); - nameMaxSizeTextField.setText(Integer.toString(exportContext.getMaxNameSize())); - nameMaxSizeTextField.setFont(MainWindow.DETAILS_FONT); - nameMaxSizeTextField.setColumns(10); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 1; - gbc.gridy = 6; - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - exportParametersPanel.add(nameMaxSizeTextField, gbc); - - JLabel lblCsvExtendedFormat = new JLabel("Format csv :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 7; - exportParametersPanel.add(lblCsvExtendedFormat, gbc); - - csvExtendedFormatChexBox = new JCheckBox("étendu"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 7; - exportParametersPanel.add(csvExtendedFormatChexBox, gbc); - csvExtendedFormatChexBox.setSelected(exportContext.isCsvExtendedFormat()); - - JLabel metadataFilterLabel = new JLabel("Filtrage des métadonnées"); - metadataFilterLabel.setFont(MainWindow.BOLD_LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.gridwidth = 3; - gbc.insets = new Insets(5, 5, 5, 5); - gbc.weightx = 1.0; - gbc.weighty = 0.0; - gbc.anchor = GridBagConstraints.NORTHWEST; - gbc.fill = GridBagConstraints.BOTH; - gbc.gridx = 0; - gbc.gridy = 8; - exportParametersPanel.add(metadataFilterLabel, gbc); - - scrollPane = new JScrollPane(); - gbc = new GridBagConstraints(); - gbc.weightx = 1.0; - gbc.weighty = 1.0; - gbc.gridwidth = 2; - gbc.fill = GridBagConstraints.BOTH; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 1; - gbc.gridy = 9; - exportParametersPanel.add(scrollPane, gbc); - - metadataFilterTextArea = new JTextArea(); - metadataFilterTextArea.setFont(MainWindow.DETAILS_FONT); - scrollPane.setViewportView(metadataFilterTextArea); - if (exportContext.getKeptMetadataList() != null) - metadataFilterTextArea.setText(String.join("\n", String.join("\n", exportContext.getKeptMetadataList()))); - metadataFilterTextArea.setCaretPosition(0); - - metadataFilterCheckBox = new JCheckBox("Seules métadonnées exportées :"); - metadataFilterCheckBox.setToolTipText("Liste des noms de métadonnées dans , utilisée comm filtre si coché "); - metadataFilterCheckBox.setSelected(exportContext.isMetadataFilterFlag()); - metadataFilterTextArea.setEnabled(exportContext.isMetadataFilterFlag()); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 9; - gbc.weighty = 1.0; - exportParametersPanel.add(metadataFilterCheckBox, gbc); - metadataFilterCheckBox.addItemListener(this::metadataFilterEvent); - - // Buttons - JButton cancelButton = new JButton("Annuler"); - cancelButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(5, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 1; - gbc.weightx=1.0; - gbc.weighty=0.0; - contentPane.add(cancelButton, gbc); - cancelButton.addActionListener(arg -> buttonCancel()); - - JButton okButton = new JButton("OK"); - okButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(5, 5, 5, 5); - gbc.gridx = 1; - gbc.gridy = 1; - gbc.weightx=1.0; - gbc.weighty=0.0; - contentPane.add(okButton, gbc); - okButton.addActionListener(arg -> buttonOk()); - - pack(); - setLocationRelativeTo(owner); - } - - // actions - - private void metadataFilterEvent(ItemEvent event) { - if (event.getStateChange() == SELECTED) { - metadataFilterTextArea.setEnabled(true); - } else if (event.getStateChange() == DESELECTED) { - metadataFilterTextArea.setEnabled(false); - } - } - - private void buttonCancel() { - returnValue = ResipGraphicApp.KO_DIALOG; - setVisible(false); - } - - private void buttonOk() { - if (!extractFromDialog()) - return; - returnValue = ResipGraphicApp.OK_DIALOG; - setVisible(false); - } - - /** - * Extract the global metadata context from dialog. - * - * @return the boolean - */ - public boolean extractFromDialog() { - int tmp; - - gmc=new ExportContext(); - gmc.setHierarchicalArchiveUnits(hierarchicalRadioButton.isSelected()); - gmc.setIndented(indentedRadioButton.isSelected()); - gmc.setReindex(reindexYesRadioButton.isSelected()); - if (firstUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(FIRST_DATAOBJECT); - else if (allUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(ALL_DATAOBJECTS); - else if (lastUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(LAST_DATAOBJECT); - try { - tmp = Integer.parseInt(nameMaxSizeTextField.getText()); - if (tmp <= 0) - throw new NumberFormatException("Number not strictly positive"); - } catch (NumberFormatException e) { - tabbedPane.setSelectedIndex(3); - UserInteractionDialog.getUserAnswer(ResipGraphicApp.mainWindow, - "La taille limite des noms de répertoires exportées doit être un nombre strictement supérieur à 0.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); - return false; - } - gmc.setMaxNameSize(tmp); - gmc.setCsvExtendedFormat(csvExtendedFormatChexBox.isSelected()); - gmc.setManagementMetadataXmlData(managementMetadataTextArea.getText()); - gmc.setMetadataFilterFlag(metadataFilterCheckBox.isSelected()); - gmc.setKeptMetadataList(Arrays.asList(metadataFilterTextArea.getText().split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList())); - - GlobalMetadata atgm=gmc.getArchiveTransferGlobalMetadata(); - atgm.comment=commentTextArea.getText(); - atgm.date=dateTextField.getText(); - atgm.setNowFlag(chckbxNowFlag.isSelected()); - atgm.messageIdentifier=messageIdentifierTextField.getText(); - atgm.archivalAgreement=archivalAgreementTextField.getText(); - atgm.codeListVersionsXmlData=clvTextArea.getText(); - atgm.transferRequestReplyIdentifier=transferRequestReplyIdentifierTextField.getText(); - atgm.archivalAgencyIdentifier=archivalAgencyIdentifierTextField.getText(); - atgm.archivalAgencyOrganizationDescriptiveMetadataXmlData= - archivalAgencyOrganizationDescriptiveMetadataTextArea.getText(); - atgm.transferringAgencyIdentifier=transferringAgencyIdentifierTextField.getText(); - atgm.transferringAgencyOrganizationDescriptiveMetadataXmlData= - transferringAgencyOrganizationDescriptiveMetadataTextArea.getText(); - return true; - } - - /** - * Get return value int. - * - * @return the return value - */ - public int getReturnValue(){ - return returnValue; - } + /** + * The actions components. + */ + private JTabbedPane tabbedPane; + + private JTextField messageIdentifierTextField; + private JTextField dateTextField; + private JCheckBox chckbxNowFlag; + private JTextArea commentTextArea; + private JTextField archivalAgreementTextField; + private JTextField archivalAgencyIdentifierTextField; + private JTextField transferringAgencyIdentifierTextField; + + private JTextArea clvTextArea; + private JTextArea managementMetadataTextArea; + private JTextField transferRequestReplyIdentifierTextField; + private JTextArea archivalAgencyOrganizationDescriptiveMetadataTextArea; + private JTextArea transferringAgencyOrganizationDescriptiveMetadataTextArea; + + private JRadioButton hierarchicalRadioButton; + private JRadioButton indentedRadioButton; + private JRadioButton reindexYesRadioButton; + private JRadioButton firstUsageButton; + private JRadioButton lastUsageButton; + private JRadioButton allUsageButton; + private JTextField nameMaxSizeTextField; + private JCheckBox csvExtendedFormatChexBox; + private JTextArea metadataFilterTextArea; + private JCheckBox metadataFilterCheckBox; + + /** + * The data. + */ + public transient ExportContext gmc; + + /** + * The return value. + */ + private int returnValue; + + // Dialog test context + + /** + * The entry point of dialog test. + * + * @param args the input arguments + * @throws ClassNotFoundException the class not found exception + * @throws UnsupportedLookAndFeelException the unsupported look and feel exception + * @throws InstantiationException the instantiation exception + * @throws IllegalAccessException the illegal access exception + * @throws NoSuchMethodException the no such method exception + * @throws InvocationTargetException the invocation target exception + */ + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + TestDialogWindow window = new TestDialogWindow(ExportContextDialog.class); + } + + /** + * Instantiates a new ExportContextDialog for test. + * + * @param owner the owner + */ + public ExportContextDialog(JFrame owner) { + this(owner, new ExportContext(Preferences.getInstance())); + } + + /** + * Create the dialog. + * + * @param owner the owner + * @param exportContext the sec + */ + public ExportContextDialog(JFrame owner, ExportContext exportContext) { + super(owner, "Edition des informations utiles à la création du manifest", true); + GridBagConstraints gbc; + + this.setPreferredSize(new Dimension(800, 500)); + this.setMinimumSize(new Dimension(500, 300)); + + Container contentPane = getContentPane(); + GridBagLayout gridBagLayout = new GridBagLayout(); + gridBagLayout.rowWeights = new double[] { 1.0, 0.1 }; + gridBagLayout.columnWeights = new double[] { 1.0, 1.0 }; + contentPane.setLayout(new GridBagLayout()); + + tabbedPane = new JTabbedPane(SwingConstants.TOP); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 0; + contentPane.add(tabbedPane, gbc); + + // header and footer simple fields + JPanel headerFooterSimplePanel = new JPanel(); + tabbedPane.addTab( + "Métadonnées globales", + new ImageIcon(getClass().getResource("/icon/document-properties.png")), + headerFooterSimplePanel, + null + ); + GridBagLayout gblHeaderFooterSimplePanel = new GridBagLayout(); + gblHeaderFooterSimplePanel.columnWidths = new int[] { 0, 0, 0 }; + gblHeaderFooterSimplePanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + gblHeaderFooterSimplePanel.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gblHeaderFooterSimplePanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }; + headerFooterSimplePanel.setLayout(gblHeaderFooterSimplePanel); + + JLabel presentationLabel = new JLabel("Champs globaux du SIP"); + presentationLabel.setFont(MainWindow.BOLD_LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.gridwidth = 3; + gbc.insets = new Insets(0, 0, 5, 0); + gbc.weightx = 1.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 0; + gbc.gridy = 0; + gbc.insets = new Insets(5, 5, 5, 5); + headerFooterSimplePanel.add(presentationLabel, gbc); + + JLabel messageIdentifierLabel = new JLabel("Identifiant du message :"); + messageIdentifierLabel.setToolTipText("MessageIdentifier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + headerFooterSimplePanel.add(messageIdentifierLabel, gbc); + + messageIdentifierTextField = new JTextField(); + messageIdentifierTextField.setText(exportContext.getArchiveTransferGlobalMetadata().messageIdentifier); + messageIdentifierTextField.setFont(MainWindow.DETAILS_FONT); + gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 1; + headerFooterSimplePanel.add(messageIdentifierTextField, gbc); + messageIdentifierTextField.setColumns(10); + + JLabel dateLabel = new JLabel("Date :"); + dateLabel.setToolTipText("ISO 8601"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 2; + headerFooterSimplePanel.add(dateLabel, gbc); + + dateTextField = new JTextField(); + dateTextField.setText(exportContext.getArchiveTransferGlobalMetadata().date); + dateTextField.setFont(MainWindow.DETAILS_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 2; + headerFooterSimplePanel.add(dateTextField, gbc); + dateTextField.setColumns(10); + + chckbxNowFlag = new JCheckBox("du jour"); + chckbxNowFlag.setSelected(exportContext.getArchiveTransferGlobalMetadata().isNowFlag()); + chckbxNowFlag.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 2; + gbc.gridy = 2; + headerFooterSimplePanel.add(chckbxNowFlag, gbc); + + JLabel lblComment = new JLabel("Commentaire :"); + lblComment.setToolTipText("Comment"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 3; + headerFooterSimplePanel.add(lblComment, gbc); + + JScrollPane scrollPane = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 3; + headerFooterSimplePanel.add(scrollPane, gbc); + + commentTextArea = new JTextArea(); + commentTextArea.setLineWrap(true); + commentTextArea.setWrapStyleWord(true); + commentTextArea.setCaretPosition(0); + scrollPane.setViewportView(commentTextArea); + commentTextArea.setText(exportContext.getArchiveTransferGlobalMetadata().comment); + commentTextArea.setFont(MainWindow.DETAILS_FONT); + + JLabel lblArchivalagreement = new JLabel("Identifiant du contrat d'entrée :"); + lblArchivalagreement.setToolTipText("ArchivalAgreement"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 4; + headerFooterSimplePanel.add(lblArchivalagreement, gbc); + + archivalAgreementTextField = new JTextField(); + archivalAgreementTextField.setText(exportContext.getArchiveTransferGlobalMetadata().archivalAgreement); + archivalAgreementTextField.setFont(MainWindow.DETAILS_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 4; + headerFooterSimplePanel.add(archivalAgreementTextField, gbc); + archivalAgreementTextField.setColumns(10); + + JLabel lblArchivalAgencyIdentifier = new JLabel("Service d'archivage :"); + lblArchivalAgencyIdentifier.setToolTipText("ArchivalAgency.Identifier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 5; + headerFooterSimplePanel.add(lblArchivalAgencyIdentifier, gbc); + + archivalAgencyIdentifierTextField = new JTextField(); + archivalAgencyIdentifierTextField.setText( + exportContext.getArchiveTransferGlobalMetadata().archivalAgencyIdentifier + ); + archivalAgencyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 5; + headerFooterSimplePanel.add(archivalAgencyIdentifierTextField, gbc); + archivalAgencyIdentifierTextField.setColumns(10); + + JLabel lblTransferringAgencyIdentifier = new JLabel("Service versant :"); + lblTransferringAgencyIdentifier.setToolTipText("TransferringAgency.Identifier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 6; + headerFooterSimplePanel.add(lblTransferringAgencyIdentifier, gbc); + + transferringAgencyIdentifierTextField = new JTextField(); + transferringAgencyIdentifierTextField.setText( + exportContext.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier + ); + transferringAgencyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 6; + headerFooterSimplePanel.add(transferringAgencyIdentifierTextField, gbc); + transferringAgencyIdentifierTextField.setColumns(10); + + // Header and footer complex fields + JPanel headerFooterComplexPanel = new JPanel(); + tabbedPane.addTab( + "Métadonnées globales étendues", + new ImageIcon(getClass().getResource("/icon/text-x-generic.png")), + headerFooterComplexPanel, + null + ); + GridBagLayout gblHeaderFooterComplexPanel = new GridBagLayout(); + gblHeaderFooterComplexPanel.columnWidths = new int[] { 0, 0, 0 }; + gblHeaderFooterComplexPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0 }; + gblHeaderFooterComplexPanel.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gblHeaderFooterComplexPanel.rowWeights = new double[] { 0.0, 1.0, 1.0, 0.0, 0.5, 0.5, 0.0 }; + headerFooterComplexPanel.setLayout(gblHeaderFooterComplexPanel); + + JLabel presentationComplexLabel = new JLabel("Champs globaux étendus du SIP"); + presentationComplexLabel.setFont(MainWindow.BOLD_LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.gridwidth = 3; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.weightx = 1.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 0; + gbc.gridy = 0; + headerFooterComplexPanel.add(presentationComplexLabel, gbc); + + JLabel clvLabel = new JLabel("Liste des codes :"); + clvLabel.setToolTipText("Bloc XML CodeListVersions"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + headerFooterComplexPanel.add(clvLabel, gbc); + + JScrollPane scrollPane1 = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 1; + headerFooterComplexPanel.add(scrollPane1, gbc); + + clvTextArea = new JTextArea(); + clvTextArea.setFont(MainWindow.DETAILS_FONT); + scrollPane1.setViewportView(clvTextArea); + clvTextArea.setText(exportContext.getArchiveTransferGlobalMetadata().codeListVersionsXmlData); + clvTextArea.setCaretPosition(0); + + JLabel managementMetadataLabel = new JLabel("Métadonnées de gestion globales :"); + managementMetadataLabel.setToolTipText("Bloc XML ManagementMetadata"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 2; + headerFooterComplexPanel.add(managementMetadataLabel, gbc); + + JScrollPane scrollPane2 = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 2; + headerFooterComplexPanel.add(scrollPane2, gbc); + + managementMetadataTextArea = new JTextArea(); + managementMetadataTextArea.setFont(MainWindow.DETAILS_FONT); + scrollPane2.setViewportView(managementMetadataTextArea); + managementMetadataTextArea.setText(exportContext.getManagementMetadataXmlData()); + managementMetadataTextArea.setCaretPosition(0); + + JLabel lblTransferRequestReplyIdentifier = new JLabel("Identifiant de réponse de transfert :"); + lblTransferRequestReplyIdentifier.setToolTipText("Valeur de TransferRequestReplyIdentifier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 3; + headerFooterComplexPanel.add(lblTransferRequestReplyIdentifier, gbc); + + transferRequestReplyIdentifierTextField = new JTextField(); + transferRequestReplyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); + transferRequestReplyIdentifierTextField.setText( + exportContext.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier + ); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 3; + headerFooterComplexPanel.add(transferRequestReplyIdentifierTextField, gbc); + transferRequestReplyIdentifierTextField.setColumns(10); + + JLabel archivalAgencyOrganizationDescriptiveMetadataLabel = new JLabel("Détails sur l'acteur d'archivage :"); + archivalAgencyOrganizationDescriptiveMetadataLabel.setToolTipText( + "Bloc XML OrganisationDescriptiveMetadata de la métadonnée ArchivalAgency " + ); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 4; + headerFooterComplexPanel.add(archivalAgencyOrganizationDescriptiveMetadataLabel, gbc); + + JScrollPane scrollPane3 = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 4; + headerFooterComplexPanel.add(scrollPane3, gbc); + + archivalAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); + archivalAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); + scrollPane3.setViewportView(archivalAgencyOrganizationDescriptiveMetadataTextArea); + archivalAgencyOrganizationDescriptiveMetadataTextArea.setText( + exportContext.getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData + ); + archivalAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); + + JLabel transferringAgencyOrganizationDescriptiveMetadataLabel = new JLabel( + "Détails sur l'acteur de transfert :" + ); + transferringAgencyOrganizationDescriptiveMetadataLabel.setToolTipText( + "Bloc XML OrganisationDescriptiveMetadata de la métadonnée TransferringAgency " + ); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 5; + headerFooterComplexPanel.add(transferringAgencyOrganizationDescriptiveMetadataLabel, gbc); + + JScrollPane scrollPane4 = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridwidth = 2; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 5; + headerFooterComplexPanel.add(scrollPane4, gbc); + + transferringAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); + transferringAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); + scrollPane4.setViewportView(transferringAgencyOrganizationDescriptiveMetadataTextArea); + transferringAgencyOrganizationDescriptiveMetadataTextArea.setText( + exportContext.getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData + ); + transferringAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); + + // ExportParameters Panel + + JPanel exportParametersPanel = new JPanel(); + tabbedPane.addTab( + "Export", + new ImageIcon(getClass().getResource("/icon/document-save.png")), + exportParametersPanel, + null + ); + GridBagLayout gblExportParametersPanel = new GridBagLayout(); + gblExportParametersPanel.columnWeights = new double[] { 0.1, 0.1, 0.5, 0.1 }; + gblExportParametersPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; + gblExportParametersPanel.rowWeights = new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + exportParametersPanel.setLayout(gblExportParametersPanel); + + JLabel inSIPLabel = new JLabel("Options de formation du SIP"); + inSIPLabel.setFont(MainWindow.BOLD_LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.gridwidth = 3; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.weightx = 1.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 0; + gbc.gridy = 0; + exportParametersPanel.add(inSIPLabel, gbc); + + JLabel hierarchicalAULabel = new JLabel("Export des AU dans le SIP:"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + exportParametersPanel.add(hierarchicalAULabel, gbc); + + JRadioButton flatRadioButton = new JRadioButton("A plat"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 2; + gbc.gridy = 1; + exportParametersPanel.add(flatRadioButton, gbc); + + hierarchicalRadioButton = new JRadioButton("Imbriquées"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 1; + exportParametersPanel.add(hierarchicalRadioButton, gbc); + + ButtonGroup hierarchicalAUButtonGroup = new ButtonGroup(); + hierarchicalAUButtonGroup.add(flatRadioButton); + hierarchicalAUButtonGroup.add(hierarchicalRadioButton); + hierarchicalAUButtonGroup.clearSelection(); + if (exportContext.isHierarchicalArchiveUnits()) hierarchicalRadioButton.setSelected(true); + else flatRadioButton.setSelected(true); + + JLabel xmlPresentationLabel = new JLabel("Présentation XML dans le SIP:"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 0; + gbc.gridy = 2; + exportParametersPanel.add(xmlPresentationLabel, gbc); + + JRadioButton linearRadioButton = new JRadioButton("Linéaire"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 2; + gbc.gridy = 2; + exportParametersPanel.add(linearRadioButton, gbc); + + indentedRadioButton = new JRadioButton("Indentée"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.gridx = 1; + gbc.gridy = 2; + exportParametersPanel.add(indentedRadioButton, gbc); + + ButtonGroup indentedButtonGroup = new ButtonGroup(); + indentedButtonGroup.add(linearRadioButton); + indentedButtonGroup.add(indentedRadioButton); + indentedButtonGroup.clearSelection(); + if (exportContext.isIndented()) indentedRadioButton.setSelected(true); + else linearRadioButton.setSelected(true); + + JLabel xmlReindexLabel = new JLabel("Renumérotation des éléments XML avant export:"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 0; + gbc.gridy = 3; + exportParametersPanel.add(xmlReindexLabel, gbc); + + reindexYesRadioButton = new JRadioButton("Oui"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 1; + gbc.gridy = 3; + exportParametersPanel.add(reindexYesRadioButton, gbc); + + JRadioButton reindexNoRadioButton = new JRadioButton("Non"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.gridx = 2; + gbc.gridy = 3; + exportParametersPanel.add(reindexNoRadioButton, gbc); + + ButtonGroup reindexButtonGroup = new ButtonGroup(); + reindexButtonGroup.add(reindexYesRadioButton); + reindexButtonGroup.add(reindexNoRadioButton); + reindexButtonGroup.clearSelection(); + if (exportContext.isReindex()) reindexYesRadioButton.setSelected(true); + else reindexNoRadioButton.setSelected(true); + + JLabel inCSVLabel = new JLabel("Options d'export en hiérarchie simplifiée et fichier csv"); + inCSVLabel.setFont(MainWindow.BOLD_LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.gridwidth = 3; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.weightx = 1.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 0; + gbc.gridy = 4; + exportParametersPanel.add(inCSVLabel, gbc); + + JLabel exportModeChoiceLabel = new JLabel("Mode de choix des objets exportés:"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 5; + exportParametersPanel.add(exportModeChoiceLabel, gbc); + + firstUsageButton = new JRadioButton("Premier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 5; + exportParametersPanel.add(firstUsageButton, gbc); + + lastUsageButton = new JRadioButton("Dernier"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 2; + gbc.gridy = 5; + exportParametersPanel.add(lastUsageButton, gbc); + + allUsageButton = new JRadioButton("Tous"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 3; + gbc.gridy = 5; + exportParametersPanel.add(allUsageButton, gbc); + + ButtonGroup exportModeChoiceButtonGroup = new ButtonGroup(); + exportModeChoiceButtonGroup.add(firstUsageButton); + exportModeChoiceButtonGroup.add(lastUsageButton); + exportModeChoiceButtonGroup.add(allUsageButton); + exportModeChoiceButtonGroup.clearSelection(); + switch (exportContext.getUsageVersionSelectionMode()) { + case FIRST_DATAOBJECT: + firstUsageButton.setSelected(true); + break; + case ALL_DATAOBJECTS: + allUsageButton.setSelected(true); + break; + case LAST_DATAOBJECT: + default: + lastUsageButton.setSelected(true); + break; + } + + JLabel lblNameMaxSize = new JLabel("Taille max des noms de répertoires :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 6; + exportParametersPanel.add(lblNameMaxSize, gbc); + + nameMaxSizeTextField = new JTextField(); + DocumentFilter filter = new NumericFilter(); + ((AbstractDocument) nameMaxSizeTextField.getDocument()).setDocumentFilter(filter); + nameMaxSizeTextField.setText(Integer.toString(exportContext.getMaxNameSize())); + nameMaxSizeTextField.setFont(MainWindow.DETAILS_FONT); + nameMaxSizeTextField.setColumns(10); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 1; + gbc.gridy = 6; + gbc.anchor = GridBagConstraints.WEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + exportParametersPanel.add(nameMaxSizeTextField, gbc); + + JLabel lblCsvExtendedFormat = new JLabel("Format csv :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 7; + exportParametersPanel.add(lblCsvExtendedFormat, gbc); + + csvExtendedFormatChexBox = new JCheckBox("étendu"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 7; + exportParametersPanel.add(csvExtendedFormatChexBox, gbc); + csvExtendedFormatChexBox.setSelected(exportContext.isCsvExtendedFormat()); + + JLabel metadataFilterLabel = new JLabel("Filtrage des métadonnées"); + metadataFilterLabel.setFont(MainWindow.BOLD_LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.gridwidth = 3; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill = GridBagConstraints.BOTH; + gbc.gridx = 0; + gbc.gridy = 8; + exportParametersPanel.add(metadataFilterLabel, gbc); + + scrollPane = new JScrollPane(); + gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = 2; + gbc.fill = GridBagConstraints.BOTH; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 1; + gbc.gridy = 9; + exportParametersPanel.add(scrollPane, gbc); + + metadataFilterTextArea = new JTextArea(); + metadataFilterTextArea.setFont(MainWindow.DETAILS_FONT); + scrollPane.setViewportView(metadataFilterTextArea); + if (exportContext.getKeptMetadataList() != null) metadataFilterTextArea.setText( + String.join("\n", String.join("\n", exportContext.getKeptMetadataList())) + ); + metadataFilterTextArea.setCaretPosition(0); + + metadataFilterCheckBox = new JCheckBox("Seules métadonnées exportées :"); + metadataFilterCheckBox.setToolTipText( + "Liste des noms de métadonnées dans , utilisée comm filtre si coché " + ); + metadataFilterCheckBox.setSelected(exportContext.isMetadataFilterFlag()); + metadataFilterTextArea.setEnabled(exportContext.isMetadataFilterFlag()); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 9; + gbc.weighty = 1.0; + exportParametersPanel.add(metadataFilterCheckBox, gbc); + metadataFilterCheckBox.addItemListener(this::metadataFilterEvent); + + // Buttons + JButton cancelButton = new JButton("Annuler"); + cancelButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + contentPane.add(cancelButton, gbc); + cancelButton.addActionListener(arg -> buttonCancel()); + + JButton okButton = new JButton("OK"); + okButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridx = 1; + gbc.gridy = 1; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + contentPane.add(okButton, gbc); + okButton.addActionListener(arg -> buttonOk()); + + pack(); + setLocationRelativeTo(owner); + } + + // actions + + private void metadataFilterEvent(ItemEvent event) { + if (event.getStateChange() == SELECTED) { + metadataFilterTextArea.setEnabled(true); + } else if (event.getStateChange() == DESELECTED) { + metadataFilterTextArea.setEnabled(false); + } + } + + private void buttonCancel() { + returnValue = ResipGraphicApp.KO_DIALOG; + setVisible(false); + } + + private void buttonOk() { + if (!extractFromDialog()) return; + returnValue = ResipGraphicApp.OK_DIALOG; + setVisible(false); + } + + /** + * Extract the global metadata context from dialog. + * + * @return the boolean + */ + public boolean extractFromDialog() { + int tmp; + + gmc = new ExportContext(); + gmc.setHierarchicalArchiveUnits(hierarchicalRadioButton.isSelected()); + gmc.setIndented(indentedRadioButton.isSelected()); + gmc.setReindex(reindexYesRadioButton.isSelected()); + if (firstUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(FIRST_DATAOBJECT); + else if (allUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(ALL_DATAOBJECTS); + else if (lastUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(LAST_DATAOBJECT); + try { + tmp = Integer.parseInt(nameMaxSizeTextField.getText()); + if (tmp <= 0) throw new NumberFormatException("Number not strictly positive"); + } catch (NumberFormatException e) { + tabbedPane.setSelectedIndex(3); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.mainWindow, + "La taille limite des noms de répertoires exportées doit être un nombre strictement supérieur à 0.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); + return false; + } + gmc.setMaxNameSize(tmp); + gmc.setCsvExtendedFormat(csvExtendedFormatChexBox.isSelected()); + gmc.setManagementMetadataXmlData(managementMetadataTextArea.getText()); + gmc.setMetadataFilterFlag(metadataFilterCheckBox.isSelected()); + gmc.setKeptMetadataList( + Arrays.asList(metadataFilterTextArea.getText().split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()) + ); + + GlobalMetadata atgm = gmc.getArchiveTransferGlobalMetadata(); + atgm.comment = commentTextArea.getText(); + atgm.date = dateTextField.getText(); + atgm.setNowFlag(chckbxNowFlag.isSelected()); + atgm.messageIdentifier = messageIdentifierTextField.getText(); + atgm.archivalAgreement = archivalAgreementTextField.getText(); + atgm.codeListVersionsXmlData = clvTextArea.getText(); + atgm.transferRequestReplyIdentifier = transferRequestReplyIdentifierTextField.getText(); + atgm.archivalAgencyIdentifier = archivalAgencyIdentifierTextField.getText(); + atgm.archivalAgencyOrganizationDescriptiveMetadataXmlData = + archivalAgencyOrganizationDescriptiveMetadataTextArea.getText(); + atgm.transferringAgencyIdentifier = transferringAgencyIdentifierTextField.getText(); + atgm.transferringAgencyOrganizationDescriptiveMetadataXmlData = + transferringAgencyOrganizationDescriptiveMetadataTextArea.getText(); + return true; + } + + /** + * Get return value int. + * + * @return the return value + */ + public int getReturnValue() { + return returnValue; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java index 6818b008..a2dc1439 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ImagePanel.java @@ -45,6 +45,7 @@ * The type Image panel. */ public class ImagePanel extends JPanel implements Serializable { + /** * The Image. */ @@ -62,15 +63,14 @@ public ImagePanel(Image image) { /** * Instantiates a new Image panel. */ - public ImagePanel() { - } + public ImagePanel() {} /** * Set image. * * @param image the image */ - public void setImage(Image image){ + public void setImage(Image image) { this.image = image; } @@ -80,16 +80,17 @@ public void setImage(Image image){ * @param image the image * @return the image */ - public Image getImage(Image image){ + public Image getImage(Image image) { return image; } + public void paintComponent(Graphics g) { super.paintComponent(g); //paint background if (image != null) { //there is a picture: draw it int height = this.getSize().height; int width = this.getSize().width; //g.drawImage(image, 0, 0, this); //use image size - g.drawImage(image,0,0, width, height, this); + g.drawImage(image, 0, 0, width, height, this); } } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java index a5ec3594..f0668363 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/InOutDialog.java @@ -81,8 +81,9 @@ public class InOutDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - TestDialogWindow window = new TestDialogWindow(InOutDialog.class);//NOSONAR used for debug run + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + TestDialogWindow window = new TestDialogWindow(InOutDialog.class); //NOSONAR used for debug run } /** @@ -112,8 +113,8 @@ public InOutDialog(JFrame owner, String title) { contentPane.setLayout(new GridBagLayout()); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.columnWeights = new double[]{1.0,1.0}; - gridBagLayout.rowWeights = new double[]{0.0, 1.0, 0.0}; + gridBagLayout.columnWeights = new double[] { 1.0, 1.0 }; + gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 0.0 }; contentPane.setLayout(gridBagLayout); JLabel lblNewLabel = new JLabel("Informations de progression"); @@ -125,7 +126,7 @@ public InOutDialog(JFrame owner, String title) { gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 0; - gbc.gridwidth=2; + gbc.gridwidth = 2; contentPane.add(lblNewLabel, gbc); JScrollPane scrollPane = new JScrollPane(); @@ -134,7 +135,7 @@ public InOutDialog(JFrame owner, String title) { gbc.insets = new Insets(0, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 1; - gbc.gridwidth=2; + gbc.gridwidth = 2; contentPane.add(scrollPane, gbc); extProgressTextArea = new JTextArea(); extProgressTextArea.setFont(MainWindow.LABEL_FONT); @@ -161,13 +162,15 @@ public InOutDialog(JFrame owner, String title) { okButton.addActionListener(arg -> buttonOk()); getRootPane().setDefaultButton(okButton); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - cancelButton.doClick(); - okButton.doClick(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + cancelButton.doClick(); + okButton.doClick(); + } } - }); + ); pack(); setLocationRelativeTo(owner); @@ -176,10 +179,8 @@ public void windowClosing(WindowEvent e) { // actions private void buttonCancel() { - if (thread != null) - thread.cancel(true); - else - setVisible(false); + if (thread != null) thread.cancel(true); + else setVisible(false); } private void buttonOk() { diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java index cf7a7e36..fae74121 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MailImportContextDialog.java @@ -52,36 +52,69 @@ */ public class MailImportContextDialog extends JDialog { - /** - * The actions components. - */ - private JCheckBox messageFileCheckBox; - private JCheckBox attachementFileCheckBox; - private JCheckBox messageMetadataCheckBox; - private JCheckBox attachementMetadataCheckBox; - private JCheckBox allowsExternalToolsForTextExtractionCheckBox; - private JRadioButton pstRadioButton; - private JRadioButton msgRadioButton; - private JRadioButton tdbRadioButton; - private JRadioButton mboxRadioButton; - private JRadioButton emlRadioButton; - private JComboBox defaultCharsetCombobox; + /** + * The actions components. + */ + private JCheckBox messageFileCheckBox; + private JCheckBox attachementFileCheckBox; + private JCheckBox messageMetadataCheckBox; + private JCheckBox attachementMetadataCheckBox; + private JCheckBox allowsExternalToolsForTextExtractionCheckBox; + private JRadioButton pstRadioButton; + private JRadioButton msgRadioButton; + private JRadioButton tdbRadioButton; + private JRadioButton mboxRadioButton; + private JRadioButton emlRadioButton; + private JComboBox defaultCharsetCombobox; /** * The result. */ public int returnValue; - /** - * The proposed charsets. - */ - static private String[] charsetStrings = {"windows-1252", "ISO-8859-1", "UTF-8", "CESU-8", "IBM00858", "IBM437", "IBM775", - "IBM850", "IBM852", "IBM855", "IBM857", "IBM862", "IBM866", "ISO-8859-2", "ISO-8859-4", "ISO-8859-5", - "ISO-8859-7", "ISO-8859-9", "ISO-8859-13", "ISO-8859-15", "KOI8-R", "KOI8-U", "US-ASCII", "UTF-16", - "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE", "x-UTF-32BE-BOM", "x-UTF-32LE-BOM", - "windows-1250", "windows-1251", "windows-1253", "windows-1254", "windows-1257"}; - - // Dialog test context + /** + * The proposed charsets. + */ + private static String[] charsetStrings = { + "windows-1252", + "ISO-8859-1", + "UTF-8", + "CESU-8", + "IBM00858", + "IBM437", + "IBM775", + "IBM850", + "IBM852", + "IBM855", + "IBM857", + "IBM862", + "IBM866", + "ISO-8859-2", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-7", + "ISO-8859-9", + "ISO-8859-13", + "ISO-8859-15", + "KOI8-R", + "KOI8-U", + "US-ASCII", + "UTF-16", + "UTF-16BE", + "UTF-16LE", + "UTF-32", + "UTF-32BE", + "UTF-32LE", + "x-UTF-32BE-BOM", + "x-UTF-32LE-BOM", + "windows-1250", + "windows-1251", + "windows-1253", + "windows-1254", + "windows-1257", + }; + + // Dialog test context /** * The entry point of dialog test. @@ -94,9 +127,10 @@ public class MailImportContextDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - TestDialogWindow window = new TestDialogWindow(MailImportContextDialog.class); - } + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + TestDialogWindow window = new TestDialogWindow(MailImportContextDialog.class); + } /** * Instantiates a new MailImportContextDialog for test. @@ -104,8 +138,8 @@ public static void main(String[] args) throws ClassNotFoundException, Unsupporte * @param owner the owner */ public MailImportContextDialog(JFrame owner) { - this(owner, new MailImportContext(Preferences.getInstance())); - } + this(owner, new MailImportContext(Preferences.getInstance())); + } /** * Create the dialog. @@ -114,226 +148,228 @@ public MailImportContextDialog(JFrame owner) { * @param mailImportContext the mail import context */ public MailImportContextDialog(JFrame owner, MailImportContext mailImportContext) { - super(owner, "Edition des paramètres d'extraction des courriels", true); - GridBagConstraints gbc; - - //this.setPreferredSize(new Dimension(500, 300)); - this.setMinimumSize(new Dimension(550, 230)); - - Container contentPane = getContentPane(); - GridBagLayout gridBagLayout = new GridBagLayout(); - contentPane.setLayout(new GridBagLayout()); - - // Parameters Panel - JPanel parametersPanel = new JPanel(); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(5, 5, 5, 5); - gbc.gridwidth = 2; - gbc.gridx = 0; - gbc.gridy = 0; - contentPane.add(parametersPanel, gbc); - GridBagLayout gbl_parametersPanel = new GridBagLayout(); - gbl_parametersPanel.columnWeights = new double[] { 0.1, 0.5, 0.5 }; - parametersPanel.setLayout(gbl_parametersPanel); - - JLabel protocolLabel = new JLabel("Protocole d'extraction courriel :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 0; - gbc.gridy = 1; - parametersPanel.add(protocolLabel, gbc); - - pstRadioButton = new JRadioButton("Outlook-Pst"); - pstRadioButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 1; - gbc.gridy = 1; - parametersPanel.add(pstRadioButton, gbc); - - msgRadioButton = new JRadioButton("Outlook-Msg"); - msgRadioButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 2; - gbc.gridy = 1; - parametersPanel.add(msgRadioButton, gbc); - - tdbRadioButton = new JRadioButton("Thunderbird"); - tdbRadioButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 1; - gbc.gridy = 2; - parametersPanel.add(tdbRadioButton, gbc); - - mboxRadioButton = new JRadioButton("Mbox"); - mboxRadioButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 2; - gbc.gridy =2; - parametersPanel.add(mboxRadioButton, gbc); - - emlRadioButton = new JRadioButton("Eml"); - emlRadioButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 0, 5); - gbc.gridx = 1; - gbc.gridy =3; - parametersPanel.add(emlRadioButton, gbc); - - ButtonGroup protocolButtonGroup = new ButtonGroup(); - protocolButtonGroup.add(pstRadioButton); - protocolButtonGroup.add(msgRadioButton); - protocolButtonGroup.add(tdbRadioButton); - protocolButtonGroup.add(mboxRadioButton); - protocolButtonGroup.add(emlRadioButton); - pstRadioButton.setSelected("pst".equals(mailImportContext.getProtocol())); - msgRadioButton.setSelected("msg".equals(mailImportContext.getProtocol())); - tdbRadioButton.setSelected("thunderbird".equals(mailImportContext.getProtocol())); - mboxRadioButton.setSelected("mbox".equals(mailImportContext.getProtocol())); - emlRadioButton.setSelected("eml".equals(mailImportContext.getProtocol())); - - defaultCharsetCombobox = new JComboBox(charsetStrings); - defaultCharsetCombobox.setFont(MainWindow.LABEL_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(0, 0, 5, 5); - gbc.fill = GridBagConstraints.HORIZONTAL; - gbc.gridx = 1; - gbc.gridy = 4; - parametersPanel.add(defaultCharsetCombobox, gbc); - defaultCharsetCombobox.setSelectedItem(mailImportContext.getDefaultCharsetName()); - - JLabel charsetLabel = new JLabel("Encodage par défaut :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 4; - parametersPanel.add(charsetLabel, gbc); - - JLabel mailFileTextExtractAULabel = new JLabel("Extraction des fichiers textes des courriels :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 5; - parametersPanel.add(mailFileTextExtractAULabel, gbc); - - messageFileCheckBox = new JCheckBox("des messages"); - messageFileCheckBox.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 5; - parametersPanel.add(messageFileCheckBox, gbc); - messageFileCheckBox.setSelected(mailImportContext.isExtractMessageTextFile()); - - attachementFileCheckBox = new JCheckBox("des pièces jointes"); - attachementFileCheckBox.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 2; - gbc.gridy = 5; - parametersPanel.add(attachementFileCheckBox, gbc); - attachementFileCheckBox.setSelected(mailImportContext.isExtractAttachmentTextFile()); - - JLabel mailMetadataTextExtractAULabel = new JLabel("Extraction des métadonnées textuelles des courriels :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 6; - parametersPanel.add(mailMetadataTextExtractAULabel, gbc); - - messageMetadataCheckBox = new JCheckBox("des messages"); - messageMetadataCheckBox.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 6; - parametersPanel.add(messageMetadataCheckBox, gbc); - messageMetadataCheckBox.setSelected(mailImportContext.isExtractMessageTextMetadata()); - - attachementMetadataCheckBox = new JCheckBox("des pièces jointes"); - attachementMetadataCheckBox.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 2; - gbc.gridy = 6; - parametersPanel.add(attachementMetadataCheckBox, gbc); - attachementMetadataCheckBox.setSelected(mailImportContext.isExtractAttachmentTextMetadata()); - - JLabel allowsExternalToolsForTextExtractionLabel = new JLabel("Extraction de métadonnées textuelles :"); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.EAST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 0; - gbc.gridy = 7; - parametersPanel.add(allowsExternalToolsForTextExtractionLabel, gbc); - - allowsExternalToolsForTextExtractionCheckBox = new JCheckBox("Utilisation d'outils externes installés"); - // allowsExternalToolsForTextExtraction flag is read-only. - // Actual setting is set during bootstrap, it cannot be updated here. - allowsExternalToolsForTextExtractionCheckBox.setEnabled(false); - gbc = new GridBagConstraints(); - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 5, 5); - gbc.gridx = 1; - gbc.gridy = 7; - parametersPanel.add(allowsExternalToolsForTextExtractionCheckBox, gbc); - allowsExternalToolsForTextExtractionCheckBox.setSelected(mailImportContext.isAllowsExternalToolsForTextExtraction()); - - // Buttons - JButton cancelButton = new JButton("Annuler"); - cancelButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(5, 5, 5, 5); - gbc.gridx = 0; - gbc.gridy = 1; - gbc.anchor=GridBagConstraints.CENTER; - gbc.weightx = 1.0; - contentPane.add(cancelButton, gbc); - cancelButton.addActionListener(arg -> buttonCancel()); - - JButton okButton = new JButton("OK"); - okButton.setFont(MainWindow.CLICK_FONT); - gbc = new GridBagConstraints(); - gbc.insets = new Insets(5, 5, 5, 5); - gbc.gridx = 1; - gbc.gridy = 1; - gbc.anchor=GridBagConstraints.CENTER; - gbc.weightx = 1.0; - contentPane.add(okButton, gbc); - okButton.addActionListener(arg -> buttonOk()); - - pack(); - setLocationRelativeTo(owner); - } - - // actions - - private void buttonCancel() { - returnValue = ResipGraphicApp.KO_DIALOG; - setVisible(false); - } - - private void buttonOk() { - returnValue = ResipGraphicApp.OK_DIALOG; - setVisible(false); - } + super(owner, "Edition des paramètres d'extraction des courriels", true); + GridBagConstraints gbc; + + //this.setPreferredSize(new Dimension(500, 300)); + this.setMinimumSize(new Dimension(550, 230)); + + Container contentPane = getContentPane(); + GridBagLayout gridBagLayout = new GridBagLayout(); + contentPane.setLayout(new GridBagLayout()); + + // Parameters Panel + JPanel parametersPanel = new JPanel(); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridwidth = 2; + gbc.gridx = 0; + gbc.gridy = 0; + contentPane.add(parametersPanel, gbc); + GridBagLayout gbl_parametersPanel = new GridBagLayout(); + gbl_parametersPanel.columnWeights = new double[] { 0.1, 0.5, 0.5 }; + parametersPanel.setLayout(gbl_parametersPanel); + + JLabel protocolLabel = new JLabel("Protocole d'extraction courriel :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 0; + gbc.gridy = 1; + parametersPanel.add(protocolLabel, gbc); + + pstRadioButton = new JRadioButton("Outlook-Pst"); + pstRadioButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 1; + gbc.gridy = 1; + parametersPanel.add(pstRadioButton, gbc); + + msgRadioButton = new JRadioButton("Outlook-Msg"); + msgRadioButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 2; + gbc.gridy = 1; + parametersPanel.add(msgRadioButton, gbc); + + tdbRadioButton = new JRadioButton("Thunderbird"); + tdbRadioButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 1; + gbc.gridy = 2; + parametersPanel.add(tdbRadioButton, gbc); + + mboxRadioButton = new JRadioButton("Mbox"); + mboxRadioButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 2; + gbc.gridy = 2; + parametersPanel.add(mboxRadioButton, gbc); + + emlRadioButton = new JRadioButton("Eml"); + emlRadioButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 0, 5); + gbc.gridx = 1; + gbc.gridy = 3; + parametersPanel.add(emlRadioButton, gbc); + + ButtonGroup protocolButtonGroup = new ButtonGroup(); + protocolButtonGroup.add(pstRadioButton); + protocolButtonGroup.add(msgRadioButton); + protocolButtonGroup.add(tdbRadioButton); + protocolButtonGroup.add(mboxRadioButton); + protocolButtonGroup.add(emlRadioButton); + pstRadioButton.setSelected("pst".equals(mailImportContext.getProtocol())); + msgRadioButton.setSelected("msg".equals(mailImportContext.getProtocol())); + tdbRadioButton.setSelected("thunderbird".equals(mailImportContext.getProtocol())); + mboxRadioButton.setSelected("mbox".equals(mailImportContext.getProtocol())); + emlRadioButton.setSelected("eml".equals(mailImportContext.getProtocol())); + + defaultCharsetCombobox = new JComboBox(charsetStrings); + defaultCharsetCombobox.setFont(MainWindow.LABEL_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(0, 0, 5, 5); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.gridx = 1; + gbc.gridy = 4; + parametersPanel.add(defaultCharsetCombobox, gbc); + defaultCharsetCombobox.setSelectedItem(mailImportContext.getDefaultCharsetName()); + + JLabel charsetLabel = new JLabel("Encodage par défaut :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 4; + parametersPanel.add(charsetLabel, gbc); + + JLabel mailFileTextExtractAULabel = new JLabel("Extraction des fichiers textes des courriels :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 5; + parametersPanel.add(mailFileTextExtractAULabel, gbc); + + messageFileCheckBox = new JCheckBox("des messages"); + messageFileCheckBox.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 5; + parametersPanel.add(messageFileCheckBox, gbc); + messageFileCheckBox.setSelected(mailImportContext.isExtractMessageTextFile()); + + attachementFileCheckBox = new JCheckBox("des pièces jointes"); + attachementFileCheckBox.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 2; + gbc.gridy = 5; + parametersPanel.add(attachementFileCheckBox, gbc); + attachementFileCheckBox.setSelected(mailImportContext.isExtractAttachmentTextFile()); + + JLabel mailMetadataTextExtractAULabel = new JLabel("Extraction des métadonnées textuelles des courriels :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 6; + parametersPanel.add(mailMetadataTextExtractAULabel, gbc); + + messageMetadataCheckBox = new JCheckBox("des messages"); + messageMetadataCheckBox.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 6; + parametersPanel.add(messageMetadataCheckBox, gbc); + messageMetadataCheckBox.setSelected(mailImportContext.isExtractMessageTextMetadata()); + + attachementMetadataCheckBox = new JCheckBox("des pièces jointes"); + attachementMetadataCheckBox.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 2; + gbc.gridy = 6; + parametersPanel.add(attachementMetadataCheckBox, gbc); + attachementMetadataCheckBox.setSelected(mailImportContext.isExtractAttachmentTextMetadata()); + + JLabel allowsExternalToolsForTextExtractionLabel = new JLabel("Extraction de métadonnées textuelles :"); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.EAST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 0; + gbc.gridy = 7; + parametersPanel.add(allowsExternalToolsForTextExtractionLabel, gbc); + + allowsExternalToolsForTextExtractionCheckBox = new JCheckBox("Utilisation d'outils externes installés"); + // allowsExternalToolsForTextExtraction flag is read-only. + // Actual setting is set during bootstrap, it cannot be updated here. + allowsExternalToolsForTextExtractionCheckBox.setEnabled(false); + gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.WEST; + gbc.insets = new Insets(0, 0, 5, 5); + gbc.gridx = 1; + gbc.gridy = 7; + parametersPanel.add(allowsExternalToolsForTextExtractionCheckBox, gbc); + allowsExternalToolsForTextExtractionCheckBox.setSelected( + mailImportContext.isAllowsExternalToolsForTextExtraction() + ); + + // Buttons + JButton cancelButton = new JButton("Annuler"); + cancelButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridx = 0; + gbc.gridy = 1; + gbc.anchor = GridBagConstraints.CENTER; + gbc.weightx = 1.0; + contentPane.add(cancelButton, gbc); + cancelButton.addActionListener(arg -> buttonCancel()); + + JButton okButton = new JButton("OK"); + okButton.setFont(MainWindow.CLICK_FONT); + gbc = new GridBagConstraints(); + gbc.insets = new Insets(5, 5, 5, 5); + gbc.gridx = 1; + gbc.gridy = 1; + gbc.anchor = GridBagConstraints.CENTER; + gbc.weightx = 1.0; + contentPane.add(okButton, gbc); + okButton.addActionListener(arg -> buttonOk()); + + pack(); + setLocationRelativeTo(owner); + } + + // actions + + private void buttonCancel() { + returnValue = ResipGraphicApp.KO_DIALOG; + setVisible(false); + } + + private void buttonOk() { + returnValue = ResipGraphicApp.OK_DIALOG; + setVisible(false); + } /** * Sets the mail import context from dialog. @@ -341,31 +377,26 @@ private void buttonOk() { * @param mailImportContext the mail import context */ public void setMailImportContextFromDialog(MailImportContext mailImportContext) { - mailImportContext.setExtractMessageTextFile(messageFileCheckBox.isSelected()); - mailImportContext.setExtractMessageTextMetadata(messageMetadataCheckBox.isSelected()); - mailImportContext.setExtractAttachmentTextFile(attachementFileCheckBox.isSelected()); - mailImportContext.setExtractAttachmentTextMetadata(attachementMetadataCheckBox.isSelected()); - // allowsExternalToolsForTextExtraction is readonly, no need to update it - mailImportContext.setExtractMessageTextFile(messageFileCheckBox.isSelected()); - if (pstRadioButton.isSelected()) - mailImportContext.setProtocol("pst"); - else if (msgRadioButton.isSelected()) - mailImportContext.setProtocol("msg"); - else if (tdbRadioButton.isSelected()) - mailImportContext.setProtocol("thunderbird"); - else if (mboxRadioButton.isSelected()) - mailImportContext.setProtocol("mbox"); - else if (emlRadioButton.isSelected()) - mailImportContext.setProtocol("eml"); - mailImportContext.setDefaultCharsetName((String) defaultCharsetCombobox.getSelectedItem()); - } + mailImportContext.setExtractMessageTextFile(messageFileCheckBox.isSelected()); + mailImportContext.setExtractMessageTextMetadata(messageMetadataCheckBox.isSelected()); + mailImportContext.setExtractAttachmentTextFile(attachementFileCheckBox.isSelected()); + mailImportContext.setExtractAttachmentTextMetadata(attachementMetadataCheckBox.isSelected()); + // allowsExternalToolsForTextExtraction is readonly, no need to update it + mailImportContext.setExtractMessageTextFile(messageFileCheckBox.isSelected()); + if (pstRadioButton.isSelected()) mailImportContext.setProtocol("pst"); + else if (msgRadioButton.isSelected()) mailImportContext.setProtocol("msg"); + else if (tdbRadioButton.isSelected()) mailImportContext.setProtocol("thunderbird"); + else if (mboxRadioButton.isSelected()) mailImportContext.setProtocol("mbox"); + else if (emlRadioButton.isSelected()) mailImportContext.setProtocol("eml"); + mailImportContext.setDefaultCharsetName((String) defaultCharsetCombobox.getSelectedItem()); + } /** * Get return value int. * * @return the return value */ - public int getReturnValue(){ - return returnValue; - } + public int getReturnValue() { + return returnValue; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java index c8465b35..03deb38c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/MainWindow.java @@ -39,25 +39,14 @@ import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents.*; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.DataObjectPackageTreeModel; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.DataObjectPackageTreeNode; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.DataObjectPackageTreeViewer; import fr.gouv.vitam.tools.resip.utils.ResipException; -import fr.gouv.vitam.tools.resip.utils.ResipLogger; -import fr.gouv.vitam.tools.sedalib.core.ArchiveUnit; -import fr.gouv.vitam.tools.sedalib.core.DataObjectPackageIdElement; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import javax.swing.*; -import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import java.nio.file.Path; - -import static fr.gouv.vitam.tools.resip.app.ResipGraphicApp.OK_DIALOG; /** * The Class MainWindow. @@ -125,7 +114,8 @@ public class MainWindow extends JFrame { * @throws ResipException the resip exception * @throws InterruptedException the interrupted exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); } @@ -174,7 +164,7 @@ private void initialize() { generalSplitPaneHoriz.setResizeWeight(0.3); getContentPane().add(generalSplitPaneHoriz); - treePane= new TreeDataObjectPackageEditorPanel(); + treePane = new TreeDataObjectPackageEditorPanel(); generalSplitPaneHoriz.setLeftComponent(treePane); itemPane = new JSplitPane(); @@ -195,24 +185,25 @@ private void initialize() { } if (ResipGraphicApp.getTheApp().interfaceParameters.isStructuredMetadataEditionFlag()) { - StructuredDataObjectGroupEditorPanel structuredDataObjectGroupEditorPanel = new StructuredDataObjectGroupEditorPanel(); + StructuredDataObjectGroupEditorPanel structuredDataObjectGroupEditorPanel = + new StructuredDataObjectGroupEditorPanel(); itemPane.setBottomComponent(structuredDataObjectGroupEditorPanel); dogMetadataPane = structuredDataObjectGroupEditorPanel; - } - else - { + } else { XMLDataObjectGroupEditorPanel xmlDataObjectGroupEditorPanel = new XMLDataObjectGroupEditorPanel(); itemPane.setBottomComponent(xmlDataObjectGroupEditorPanel); dogMetadataPane = xmlDataObjectGroupEditorPanel; } setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - ResipGraphicApp.getTheApp().exit(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + ResipGraphicApp.getTheApp().exit(); + } } - }); + ); pack(); } @@ -224,7 +215,6 @@ public void load() { try { treePane.editDataObjectPackage(app.currentWork == null ? null : app.currentWork.getDataObjectPackage()); auMetadataPane.editArchiveUnit(null); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java index 87098700..e94b0e02 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestFindToolBar.java @@ -44,6 +44,7 @@ import java.awt.*; public class ManifestFindToolBar extends FindToolBar { + public ManifestFindToolBar(SearchListener listener) { super(listener); } @@ -100,6 +101,4 @@ protected Container createButtonPanel() { //panel.add(this.markAllCheckBox); return panel; } - - } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java index 5cc6dece..833f7eab 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/ManifestWindow.java @@ -38,8 +38,8 @@ package fr.gouv.vitam.tools.resip.frame; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; -import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import fr.gouv.vitam.tools.resip.utils.ResipException; +import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import org.fife.rsta.ui.search.SearchEvent; import org.fife.rsta.ui.search.SearchListener; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; @@ -84,7 +84,8 @@ public class ManifestWindow extends JFrame implements SearchListener { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); ManifestWindow mw = new ManifestWindow(); @@ -103,9 +104,9 @@ public ManifestWindow() throws InterruptedException { setMinimumSize(new Dimension(700, 300)); gbl = new GridBagLayout(); - gbl.rowWeights = new double[]{1.0, 0.0}; - gbl.columnWeights = new double[]{1.0, 0, 0, 0.0}; - gbl.columnWidths = new int[]{400, 0, 200}; + gbl.rowWeights = new double[] { 1.0, 0.0 }; + gbl.columnWeights = new double[] { 1.0, 0, 0, 0.0 }; + gbl.columnWidths = new int[] { 400, 0, 200 }; Container contentPane = getContentPane(); contentPane.setLayout(gbl); @@ -146,7 +147,6 @@ public ManifestWindow() throws InterruptedException { gbc.gridy = 1; contentPane.add(separator, gbc); - statusLabel = new JLabel("Prêt"); gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); @@ -172,7 +172,6 @@ public void setText(String text) { @Override public void searchEvent(SearchEvent e) { - SearchEvent.Type type = e.getType(); SearchContext context = e.getSearchContext(); SearchResult result; @@ -202,12 +201,10 @@ public void searchEvent(SearchEvent e) { text = "Trouvé"; } statusLabel.setText(text); - } @Override public String getSelectedText() { return xmlTextArea.getSelectedText(); } - } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java index 0b918b25..c30d0bc2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/NumericFilter.java @@ -45,17 +45,16 @@ * The type Numeric filter. */ public class NumericFilter extends DocumentFilter { + @Override - public void replace(FilterBypass fb, int offs, int length, - String str, AttributeSet a) throws BadLocationException { + public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a) throws BadLocationException { str = str.replaceAll("[^0-9]", ""); super.replace(fb, offs, length, str, a); } @Override - public void insertString(FilterBypass fb, int offs, String str, - AttributeSet a) throws BadLocationException { + public void insertString(FilterBypass fb, int offs, String str, AttributeSet a) throws BadLocationException { str = str.replaceAll("[^0-9]", ""); super.insertString(fb, offs, str, a); } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java index 7b4d427b..f844eb80 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/SearchDialog.java @@ -95,7 +95,8 @@ public class SearchDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(SearchDialog.class); } @@ -116,7 +117,6 @@ public SearchDialog(JFrame owner) throws ResipException { */ public SearchDialog(MainWindow owner) { super(owner, "Chercher des unités d'archives", false); - searchThread = null; setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); @@ -296,8 +296,10 @@ public SearchDialog(MainWindow owner) { gbc.gridx = 0; gbc.gridy = 1; optionalInfoPanel.add(informationLabel, gbc); - JTextArea informationTextArea = new JTextArea("Il s'agit d'une recherche par expression régulière de type java d'une partie quelconque de la chaine, avec les caractères spéciaux classiques .?+*[]^|\\\\s\\w...\n" + - "Pour plus d'info chercher sur Internet \"Regexp java\""); + JTextArea informationTextArea = new JTextArea( + "Il s'agit d'une recherche par expression régulière de type java d'une partie quelconque de la chaine, avec les caractères spéciaux classiques .?+*[]^|\\\\s\\w...\n" + + "Pour plus d'info chercher sur Internet \"Regexp java\"" + ); informationTextArea.setFont(MainWindow.LABEL_FONT); informationTextArea.setEditable(false); informationTextArea.setLineWrap(true); @@ -319,12 +321,14 @@ public SearchDialog(MainWindow owner) { pack(); setLocationRelativeTo(owner); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - close(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } } - }); + ); } // actions @@ -361,10 +365,17 @@ private void regexpEvent(ItemEvent event) { private void buttonSearch() { if (searchThread == null) { - searchThread = new SearchThread(mainWindow.getApp().currentWork.getDataObjectPackage().getGhostRootAu(), - withoutChildArchiveUnitCheckBox.isSelected(), withoutChildDataObjectCheckBox.isSelected(), - idCheckBox.isSelected(), metadataCheckBox.isSelected(), regExpCheckBox.isSelected(), caseCheckBox.isSelected(), - searchTextField.getText(), e -> setSearchResult(e)); + searchThread = new SearchThread( + mainWindow.getApp().currentWork.getDataObjectPackage().getGhostRootAu(), + withoutChildArchiveUnitCheckBox.isSelected(), + withoutChildDataObjectCheckBox.isSelected(), + idCheckBox.isSelected(), + metadataCheckBox.isSelected(), + regExpCheckBox.isSelected(), + caseCheckBox.isSelected(), + searchTextField.getText(), + e -> setSearchResult(e) + ); searchThread.execute(); searchResult = null; resultLabel.setText("En cours"); @@ -374,7 +385,13 @@ private void buttonSearch() { private void buttonNext() { if (searchResult != null && searchResult.size() > 0) { searchResultPosition = Math.min(searchResultPosition + 1, searchResult.size() - 1); - resultLabel.setText((searchResultPosition + 1) + "/" + searchResult.size() + " trouvé" + (searchResult.size() > 1 ? "s" : "")); + resultLabel.setText( + (searchResultPosition + 1) + + "/" + + searchResult.size() + + " trouvé" + + (searchResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchResult.get(searchResultPosition)); } } @@ -382,7 +399,13 @@ private void buttonNext() { private void buttonPrevious() { if (searchResult != null && searchResult.size() > 0) { searchResultPosition = Math.max(searchResultPosition - 1, 0); - resultLabel.setText((searchResultPosition + 1) + "/" + searchResult.size() + " trouvé" + (searchResult.size() > 1 ? "s" : "")); + resultLabel.setText( + (searchResultPosition + 1) + + "/" + + searchResult.size() + + " trouvé" + + (searchResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchResult.get(searchResultPosition)); } } @@ -398,8 +421,7 @@ public void setSearchResult(List searchResult) { if (searchResult.size() > 0) { resultLabel.setText("1/" + searchResult.size() + " trouvé" + (searchResult.size() > 1 ? "s" : "")); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchResult.get(0)); - } else - resultLabel.setText("0 trouvé"); + } else resultLabel.setText("0 trouvé"); searchThread = null; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java index 4c021f7e..5bfd2ae2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/StatisticWindow.java @@ -39,11 +39,11 @@ import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; import fr.gouv.vitam.tools.resip.data.StatisticData; -import fr.gouv.vitam.tools.resip.threads.StatisticThread; -import fr.gouv.vitam.tools.resip.utils.ResipException; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.DefaultTableHeaderCellRenderer; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.StatisticCellRenderer; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers.StatisticTableModel; +import fr.gouv.vitam.tools.resip.threads.StatisticThread; +import fr.gouv.vitam.tools.resip.utils.ResipException; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -92,23 +92,22 @@ public class StatisticWindow extends JFrame { * @throws ResipException the resip exception * @throws InterruptedException the interrupted exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); StatisticWindow window = new StatisticWindow(); ArrayList sdl = new ArrayList(); - sdl.add(new StatisticData("Test", Arrays.asList(new Long(1), new Long(2), - new Long(3), new Long(4), new Long(5)))); + sdl.add( + new StatisticData("Test", Arrays.asList(new Long(1), new Long(2), new Long(3), new Long(4), new Long(5))) + ); sdl.add(new StatisticData("No", Arrays.asList())); - ((StatisticTableModel) (window.statisticTable.getModel())) - .setStatisticDataList(sdl); + ((StatisticTableModel) (window.statisticTable.getModel())).setStatisticDataList(sdl); window.statisticTable.getRowSorter().toggleSortOrder(1); window.statisticTable.getRowSorter().toggleSortOrder(1); window.statisticTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); - ((StatisticTableModel) (window.statisticTable.getModel())) - .fireTableDataChanged(); - window.statisticTable.getColumnModel().getColumn(0) - .setPreferredWidth(200); + ((StatisticTableModel) (window.statisticTable.getModel())).fireTableDataChanged(); + window.statisticTable.getColumnModel().getColumn(0).setPreferredWidth(200); window.setVisible(true); } @@ -130,8 +129,8 @@ public StatisticWindow() { Container contentPane = getContentPane(); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.columnWeights = new double[]{1.0, 1.0, 1.0}; - gridBagLayout.rowWeights = new double[]{0.0, 1.0, 0.0}; + gridBagLayout.columnWeights = new double[] { 1.0, 1.0, 1.0 }; + gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 0.0 }; contentPane.setLayout(gridBagLayout); JLabel lblNewLabel = new JLabel("Par catégories de format"); @@ -161,23 +160,25 @@ public StatisticWindow() { statisticTable.setDefaultRenderer(Object.class, new StatisticCellRenderer()); statisticTable.setDefaultRenderer(Long.class, new StatisticCellRenderer()); statisticTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderCellRenderer()); - statisticTable.getColumnModel().getColumn(0) - .setPreferredWidth(250); + statisticTable.getColumnModel().getColumn(0).setPreferredWidth(250); ListSelectionModel selectionModel = statisticTable.getSelectionModel(); - selectionModel.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - handleFormatSelectionEvent(e); + selectionModel.addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + handleFormatSelectionEvent(e); + } } - }); - statisticTable.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent me) { - JTable table =(JTable) me.getSource(); - Point p = me.getPoint(); - int row = table.rowAtPoint(p); - if (me.getClickCount() ==2) - buttonSearch(); + ); + statisticTable.addMouseListener( + new MouseAdapter() { + public void mousePressed(MouseEvent me) { + JTable table = (JTable) me.getSource(); + Point p = me.getPoint(); + int row = table.rowAtPoint(p); + if (me.getClickCount() == 2) buttonSearch(); + } } - }); + ); scrollPane.setViewportView(statisticTable); JButton copyButton = new JButton(""); @@ -246,8 +247,10 @@ public void mousePressed(MouseEvent me) { gbc.gridx = 0; gbc.gridy = 1; warningPanel.add(informationLabel, gbc); - JTextArea warningTextArea = new JTextArea("Attention, votre contexte de travail contient des fichiers vides ce qui n'est " + - "pas accepté dans le standard SEDA. Veillez à les supprimer pour construire un SIP valide."); + JTextArea warningTextArea = new JTextArea( + "Attention, votre contexte de travail contient des fichiers vides ce qui n'est " + + "pas accepté dans le standard SEDA. Veillez à les supprimer pour construire un SIP valide." + ); warningTextArea.setFont(MainWindow.LABEL_FONT); warningTextArea.setEditable(false); warningTextArea.setLineWrap(true); @@ -277,23 +280,20 @@ public void mousePressed(MouseEvent me) { // actions private void handleFormatSelectionEvent(ListSelectionEvent e) { - if (e.getValueIsAdjusting()) - return; + if (e.getValueIsAdjusting()) return; final DefaultListSelectionModel target = (DefaultListSelectionModel) e.getSource(); int selectedIndex = target.getMinSelectionIndex(); - if (selectedIndex>=0) - formatCategory = (String) statisticTable.getModel().getValueAt(statisticTable - .convertRowIndexToModel(selectedIndex), 0); - else - formatCategory=null; + if (selectedIndex >= 0) formatCategory = (String) statisticTable + .getModel() + .getValueAt(statisticTable.convertRowIndexToModel(selectedIndex), 0); + else formatCategory = null; } private void buttonSearch() { if (formatCategory != null) { - if (ResipGraphicApp.getTheApp().technicalSearchDialog == null) - ResipGraphicApp.getTheApp().technicalSearchDialog = - new TechnicalSearchDialog(ResipGraphicApp.getTheApp().mainWindow); + if (ResipGraphicApp.getTheApp().technicalSearchDialog == null) ResipGraphicApp.getTheApp() + .technicalSearchDialog = new TechnicalSearchDialog(ResipGraphicApp.getTheApp().mainWindow); TechnicalSearchDialog technicalSearchDialog = ResipGraphicApp.getTheApp().technicalSearchDialog; technicalSearchDialog.emptyDialog(); technicalSearchDialog.setFormatCategory(formatCategory); @@ -328,8 +328,7 @@ public void copyToClipboard() { for (int i = 0; i < numRows; i++) { for (int j = 0; j < numColumns; j++) { Object value = statisticTable.getValueAt(i, j); - if (!(value instanceof Long) || ((long) value != Long.MAX_VALUE)) - sbf.append(value); + if (!(value instanceof Long) || ((long) value != Long.MAX_VALUE)) sbf.append(value); if (j < numColumns - 1) sbf.append("\t"); } sbf.append("\n"); @@ -343,9 +342,8 @@ public void copyToClipboard() { * Empty search. */ public void emptySearch() { - if (ResipGraphicApp.getTheApp().technicalSearchDialog == null) - ResipGraphicApp.getTheApp().technicalSearchDialog = - new TechnicalSearchDialog(ResipGraphicApp.getTheApp().mainWindow); + if (ResipGraphicApp.getTheApp().technicalSearchDialog == null) ResipGraphicApp.getTheApp() + .technicalSearchDialog = new TechnicalSearchDialog(ResipGraphicApp.getTheApp().mainWindow); TechnicalSearchDialog technicalSearchDialog = ResipGraphicApp.getTheApp().technicalSearchDialog; technicalSearchDialog.emptyDialog(); technicalSearchDialog.setMinMax(0, 0); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java index 5028153a..9c711a04 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/TechnicalSearchDialog.java @@ -112,7 +112,8 @@ public class TechnicalSearchDialog extends JDialog { * @throws ResipException the resip exception * @throws InterruptedException the interrupted exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); TestDialogWindow window = new TestDialogWindow(TechnicalSearchDialog.class); @@ -181,8 +182,9 @@ public TechnicalSearchDialog(MainWindow owner) { gbc.anchor = GridBagConstraints.WEST; criteriaPanel.add(formatCategoryCheckBox, gbc); formatCategoryCheckBox.addItemListener(arg -> formatCategoryEvent(arg)); - formatCategoryComboBox = new JComboBox<>(ResipGraphicApp.getTheApp(). - treatmentParameters.getFormatByCategoryMap().keySet().toArray()); + formatCategoryComboBox = new JComboBox<>( + ResipGraphicApp.getTheApp().treatmentParameters.getFormatByCategoryMap().keySet().toArray() + ); formatCategoryComboBox.setEnabled(false); formatCategoryComboBox.setFont(MainWindow.LABEL_FONT); gbc = new GridBagConstraints(); @@ -312,8 +314,8 @@ public TechnicalSearchDialog(MainWindow owner) { gbc.fill = GridBagConstraints.BOTH; actionPanel.add(separator, gbc); JCheckBox moreOptionsCheckBox = new JCheckBox(); - moreOptionsCheckBox.setPreferredSize(new Dimension(250,36)); - moreOptionsCheckBox.setMinimumSize(new Dimension(250,36)); + moreOptionsCheckBox.setPreferredSize(new Dimension(250, 36)); + moreOptionsCheckBox.setMinimumSize(new Dimension(250, 36)); moreOptionsCheckBox.setEnabled(true); moreOptionsCheckBox.setIcon(new ImageIcon(getClass().getResource("/icon/list-add.png"))); moreOptionsCheckBox.setSelectedIcon(new ImageIcon(getClass().getResource("/icon/list-remove.png"))); @@ -376,7 +378,7 @@ public TechnicalSearchDialog(MainWindow owner) { JPanel resultPanel = new JPanel(); resultPanel.setLayout(new GridBagLayout()); resultPanel.setMinimumSize(new Dimension(250, 36)); - resultPanel.setPreferredSize(new Dimension(250,36)); + resultPanel.setPreferredSize(new Dimension(250, 36)); gbc = new GridBagConstraints(); gbc.gridx = 4; gbc.gridy = 1; @@ -429,12 +431,14 @@ public TechnicalSearchDialog(MainWindow owner) { explanationTextArea.setFont(new JLabel().getFont()); explanationTextArea.setBackground(UIManager.getColor("Dialog.background")); explanationTextArea.setFocusable(false); - explanationTextArea.setText("La recherche se fait sur :\n" + - "- l'ensemble des formats fournis, selon les choix cochés, par:\n" + - " - une catégorie de fichiers, déterminant une liste de PUID Pronom,\n" + - " - une liste libre de PUID Pronom séparés par des virgules (par exemple: x-fmt/111, fmt/101)\n" + - " En cliquant sur le bouton de mise à jour, on peut voir la liste de l'ensemble des formats pris en compte.\n" + - "- la taille du fichier."); + explanationTextArea.setText( + "La recherche se fait sur :\n" + + "- l'ensemble des formats fournis, selon les choix cochés, par:\n" + + " - une catégorie de fichiers, déterminant une liste de PUID Pronom,\n" + + " - une liste libre de PUID Pronom séparés par des virgules (par exemple: x-fmt/111, fmt/101)\n" + + " En cliquant sur le bouton de mise à jour, on peut voir la liste de l'ensemble des formats pris en compte.\n" + + "- la taille du fichier." + ); explanationTextArea.setWrapStyleWord(true); gbc = new GridBagConstraints(); gbc.gridx = 1; @@ -452,20 +456,22 @@ public TechnicalSearchDialog(MainWindow owner) { pack(); setLocationRelativeTo(owner); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - close(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } } - }); + ); } // actions - private void close(){ - if (technicalSearchThread!=null) { + private void close() { + if (technicalSearchThread != null) { technicalSearchThread.cancel(true); - technicalSearchThread=null; + technicalSearchThread = null; resultArchiveUnitLabel.setText("Aucune recherche"); resultObjectLabel.setText(""); } @@ -494,8 +500,11 @@ private void moreExplanationEvent(ItemEvent event) { private List constructFormatList() { List result = new ArrayList(); if (formatCategoryCheckBox.isSelected()) { - result.addAll(ResipGraphicApp.getTheApp().treatmentParameters.getFormatByCategoryMap(). - get((String) formatCategoryComboBox.getSelectedItem())); + result.addAll( + ResipGraphicApp.getTheApp() + .treatmentParameters.getFormatByCategoryMap() + .get((String) formatCategoryComboBox.getSelectedItem()) + ); } if (formatListCheckBox.isSelected()) { List formats = Arrays.asList(formatListTextField.getText().split(",")); @@ -535,13 +544,11 @@ private void showFormatList() { formatsTextArea.setText(String.join("\n", constructFormatList())); } - private void buttonSearch() { showFormatList(); - if (technicalSearchThread==null) { + if (technicalSearchThread == null) { long min, max; - if (minTextField.getText().isEmpty() || !sizeCheckBox.isSelected()) - min = 0; + if (minTextField.getText().isEmpty() || !sizeCheckBox.isSelected()) min = 0; else { try { min = Long.parseLong(minTextField.getText()); @@ -549,21 +556,24 @@ private void buttonSearch() { min = 0; } } - if (maxTextField.getText().isEmpty() || !sizeCheckBox.isSelected()) + if (maxTextField.getText().isEmpty() || !sizeCheckBox.isSelected()) max = Long.MAX_VALUE; + else try { + max = Long.parseLong(maxTextField.getText()); + } catch (NumberFormatException e) { max = Long.MAX_VALUE; - else - try { - max = Long.parseLong(maxTextField.getText()); - } catch (NumberFormatException e) { - max = Long.MAX_VALUE; - } + } if (min > max) { long tmp = max; max = min; min = tmp; } - technicalSearchThread = new TechnicalSearchThread( mainWindow.getApp().currentWork.getDataObjectPackage().getGhostRootAu(), - constructFormatList(), min, max, e->setDataObjectSearchResult(e)); + technicalSearchThread = new TechnicalSearchThread( + mainWindow.getApp().currentWork.getDataObjectPackage().getGhostRootAu(), + constructFormatList(), + min, + max, + e -> setDataObjectSearchResult(e) + ); technicalSearchThread.execute(); resultArchiveUnitLabel.setText("En cours"); resultObjectLabel.setText(""); @@ -586,7 +596,11 @@ private void buttonNext() { } resultArchiveUnitLabel.setText(stepArchiveUnitInfo()); resultObjectLabel.setText(stepObjectInfo()); - ResipGraphicApp.getTheWindow().treePane.focusDataObject(searchCurrentArchiveUnit,searchResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + ResipGraphicApp.getTheWindow() + .treePane.focusDataObject( + searchCurrentArchiveUnit, + searchResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); } } @@ -606,21 +620,35 @@ private void buttonPrevious() { } resultArchiveUnitLabel.setText(stepArchiveUnitInfo()); resultObjectLabel.setText(stepObjectInfo()); - ResipGraphicApp.getTheWindow().treePane.focusDataObject(searchCurrentArchiveUnit,searchResult.get(searchCurrentArchiveUnit).get(searchObjectPosition)); + ResipGraphicApp.getTheWindow() + .treePane.focusDataObject( + searchCurrentArchiveUnit, + searchResult.get(searchCurrentArchiveUnit).get(searchObjectPosition) + ); } } private String stepArchiveUnitInfo() { - return "" + (searchArchiveUnitPosition + 1) + "/" + searchResultListCount + " AU trouvé" + - (searchResultCount > 1 ? "s" : ""); + return ( + "" + + (searchArchiveUnitPosition + 1) + + "/" + + searchResultListCount + + " AU trouvé" + + (searchResultCount > 1 ? "s" : "") + ); } private String stepObjectInfo() { - if (searchResultListCount == 0) - return ""; - else - return "" + (searchResultPosition + 1) + "/" + searchResultCount + - " obj. trouvé" + (searchResultCount > 1 ? "s" : ""); + if (searchResultListCount == 0) return ""; + else return ( + "" + + (searchResultPosition + 1) + + "/" + + searchResultCount + + " obj. trouvé" + + (searchResultCount > 1 ? "s" : "") + ); } /** @@ -640,7 +668,11 @@ public void setDataObjectSearchResult(LinkedHashMap dialogClass) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public TestDialogWindow(Class dialogClass) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { super("TestDialog"); - this.dialogClass=dialogClass; + this.dialogClass = dialogClass; - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); JMenuBar menuBar = createMenu(); setJMenuBar(menuBar); @@ -129,41 +130,59 @@ public void actionPerformed(final ActionEvent actionEvent) { if (source instanceof JMenuItem) { String action = ((JMenuItem) source).getText(); - if (action == null) - System.err.println("unknown menu action"); - else - switch (action) { - // File Menu - case "System": - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - MainWindow.LABEL_FONT=UIManager.getFont("Label.font"); - MainWindow.CLICK_FONT=UIManager.getFont("Button.font"); - MainWindow.BOLD_LABEL_FONT = MainWindow.LABEL_FONT.deriveFont(MainWindow.LABEL_FONT.getStyle() | Font.BOLD); - MainWindow.TREE_FONT=MainWindow.LABEL_FONT; - MainWindow.DETAILS_FONT=MainWindow.LABEL_FONT.deriveFont(MainWindow.LABEL_FONT.getSize()+(float)2.0); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored) { - } - break; - case "CrossPlatform": - try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - MainWindow.LABEL_FONT=UIManager.getFont("Label.font"); - MainWindow.CLICK_FONT=UIManager.getFont("Button.font"); - MainWindow.BOLD_LABEL_FONT = MainWindow.LABEL_FONT.deriveFont(MainWindow.LABEL_FONT.getStyle() | Font.BOLD); - MainWindow.TREE_FONT=MainWindow.LABEL_FONT; - MainWindow.DETAILS_FONT=MainWindow.LABEL_FONT.deriveFont(MainWindow.LABEL_FONT.getSize()+(float)2.0); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored) { - } - break; - } + if (action == null) System.err.println("unknown menu action"); + else switch (action) { + // File Menu + case "System": + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + MainWindow.LABEL_FONT = UIManager.getFont("Label.font"); + MainWindow.CLICK_FONT = UIManager.getFont("Button.font"); + MainWindow.BOLD_LABEL_FONT = MainWindow.LABEL_FONT.deriveFont( + MainWindow.LABEL_FONT.getStyle() | Font.BOLD + ); + MainWindow.TREE_FONT = MainWindow.LABEL_FONT; + MainWindow.DETAILS_FONT = MainWindow.LABEL_FONT.deriveFont( + MainWindow.LABEL_FONT.getSize() + (float) 2.0 + ); + } catch ( + ClassNotFoundException + | InstantiationException + | IllegalAccessException + | UnsupportedLookAndFeelException ignored + ) {} + break; + case "CrossPlatform": + try { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + MainWindow.LABEL_FONT = UIManager.getFont("Label.font"); + MainWindow.CLICK_FONT = UIManager.getFont("Button.font"); + MainWindow.BOLD_LABEL_FONT = MainWindow.LABEL_FONT.deriveFont( + MainWindow.LABEL_FONT.getStyle() | Font.BOLD + ); + MainWindow.TREE_FONT = MainWindow.LABEL_FONT; + MainWindow.DETAILS_FONT = MainWindow.LABEL_FONT.deriveFont( + MainWindow.LABEL_FONT.getSize() + (float) 2.0 + ); + } catch ( + ClassNotFoundException + | InstantiationException + | IllegalAccessException + | UnsupportedLookAndFeelException ignored + ) {} + break; + } it.setVisible(false); try { it = dialogClass.getConstructor(JFrame.class).newInstance(this); it.setLocationByPlatform(true); it.setVisible(true); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ignored) { - } + } catch ( + InstantiationException + | IllegalAccessException + | NoSuchMethodException + | InvocationTargetException ignored + ) {} } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java index 65e64fbd..7658c33c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UsedTmpDirDialog.java @@ -97,7 +97,8 @@ public class UsedTmpDirDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(UsedTmpDirDialog.class); } @@ -306,9 +307,11 @@ public UsedTmpDirDialog(JFrame owner, String baseDir, String subDir) { explanationTextAres.setBackground(UIManager.getColor("Dialog.background")); explanationTextAres.setFocusable(false); explanationTextAres.setMinimumSize(new Dimension(500, 70)); - explanationTextAres.setText("Le répertoire dans lequel vous allez extraire des informations temporaires pour traitement (issues d'un SIP, DIP, conteneur de mails...) n'est pas vide.\n" + - "Vous pouvez effacer ce répertoire et continuer ou annuler.\n" + - "En cliquant sur \"Plus d'options\" vous pouvez aussi continuer sur place au risque de mélanger des informations de différentes extractions ou encore changer de répertoire."); + explanationTextAres.setText( + "Le répertoire dans lequel vous allez extraire des informations temporaires pour traitement (issues d'un SIP, DIP, conteneur de mails...) n'est pas vide.\n" + + "Vous pouvez effacer ce répertoire et continuer ou annuler.\n" + + "En cliquant sur \"Plus d'options\" vous pouvez aussi continuer sur place au risque de mélanger des informations de différentes extractions ou encore changer de répertoire." + ); explanationTextAres.setWrapStyleWord(true); gbc = new GridBagConstraints(); gbc.gridx = 1; @@ -360,12 +363,11 @@ private void buttonCleanDirectory() { private String chooseDiskName(String from) { JFileChooser fileChooser = new JFileChooser(from); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) - try { - return fileChooser.getSelectedFile().getCanonicalPath(); - } catch (IOException e) { - return null; - } + if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) try { + return fileChooser.getSelectedFile().getCanonicalPath(); + } catch (IOException e) { + return null; + } return null; } @@ -404,8 +406,7 @@ private void changeDir(String dir) { private void buttonChangeDirectory() { String newTarget = chooseDiskName(target); - if (newTarget == null) - return; + if (newTarget == null) return; target = newTarget; if (Files.exists(Paths.get(newTarget))) { changeDir(target); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java index 8993fcfb..d2cbdef8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/UserInteractionDialog.java @@ -57,24 +57,24 @@ public class UserInteractionDialog extends JDialog { /** * The Information dialog. */ - static public final int INFORMATION_DIALOG = 0; + public static final int INFORMATION_DIALOG = 0; /** * The Warning dialog. */ - static public final int WARNING_DIALOG = 1; + public static final int WARNING_DIALOG = 1; /** * The Error dialog. */ - static public final int ERROR_DIALOG = 2; + public static final int ERROR_DIALOG = 2; /** * The Important dialog. */ - static public final int IMPORTANT_DIALOG = 3; + public static final int IMPORTANT_DIALOG = 3; /** * The actions components. */ - final private JPanel explanationPanel; + private final JPanel explanationPanel; /** * The return value. @@ -94,7 +94,8 @@ public class UserInteractionDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(UserInteractionDialog.class); } @@ -104,11 +105,15 @@ public static void main(String[] args) throws ClassNotFoundException, Unsupporte * @param owner the owner */ public UserInteractionDialog(JFrame owner) { - this(owner, "This is a warning message, with a question to answer...", "Important", WARNING_DIALOG, - "This is explanation"); + this( + owner, + "This is a warning message, with a question to answer...", + "Important", + WARNING_DIALOG, + "This is explanation" + ); } - /** * Gets user answer. * @@ -119,7 +124,13 @@ public UserInteractionDialog(JFrame owner) { * @param optionalExplationMessage the optional explation message * @return the user answer */ - static public int getUserAnswer(JFrame owner, String message, String title, int kind, String optionalExplationMessage) { + public static int getUserAnswer( + JFrame owner, + String message, + String title, + int kind, + String optionalExplationMessage + ) { UserInteractionDialog dialog = new UserInteractionDialog(owner, message, title, kind, optionalExplationMessage); dialog.setVisible(true); return dialog.returnValue; @@ -134,11 +145,17 @@ static public int getUserAnswer(JFrame owner, String message, String title, int * @param kind the kind * @param optionalExplationMessage the optional explation message */ - public UserInteractionDialog(JFrame owner, String message, String title, int kind, String optionalExplationMessage) { + public UserInteractionDialog( + JFrame owner, + String message, + String title, + int kind, + String optionalExplationMessage + ) { super(owner, title, true); GridBagConstraints gbc; - this.setMinimumSize(new Dimension(400,100)); + this.setMinimumSize(new Dimension(400, 100)); this.setResizable(false); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); @@ -223,29 +240,25 @@ public UserInteractionDialog(JFrame owner, String message, String title, int kin JButton buttonCancel = new JButton(); buttonCancel.setText("Annuler"); gbc = new GridBagConstraints(); - gbc.gridx = 2-(optionalExplationMessage == null?1:0); + gbc.gridx = 2 - (optionalExplationMessage == null ? 1 : 0); gbc.gridy = 0; gbc.weightx = 1.0; - if (optionalExplationMessage != null) - gbc.anchor = GridBagConstraints.EAST; - else - gbc.anchor = GridBagConstraints.CENTER; + if (optionalExplationMessage != null) gbc.anchor = GridBagConstraints.EAST; + else gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(5, 5, 5, 5); - buttonCancel.addActionListener(arg->buttonCancel()); + buttonCancel.addActionListener(arg -> buttonCancel()); mainActionPanel.add(buttonCancel, gbc); } JButton buttonOK = new JButton(); buttonOK.setText("OK"); gbc = new GridBagConstraints(); - gbc.gridx = 1-(optionalExplationMessage == null?1:0); + gbc.gridx = 1 - (optionalExplationMessage == null ? 1 : 0); gbc.gridy = 0; gbc.weightx = 1.0; - if (optionalExplationMessage != null) - gbc.anchor = GridBagConstraints.EAST; - else - gbc.anchor = GridBagConstraints.CENTER; + if (optionalExplationMessage != null) gbc.anchor = GridBagConstraints.EAST; + else gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(5, 5, 5, 5); - buttonOK.addActionListener(arg->buttonOK()); + buttonOK.addActionListener(arg -> buttonOK()); mainActionPanel.add(buttonOK, gbc); explanationPanel = new JPanel(); @@ -290,12 +303,14 @@ public UserInteractionDialog(JFrame owner, String message, String title, int kin explanationPanel.add(explanationTextArea, gbc); } - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - buttonCancel(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + buttonCancel(); + } } - }); + ); pack(); explanationPanel.setVisible(false); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java index f884c58b..2886fa20 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/VerifyDateDialog.java @@ -78,7 +78,6 @@ public VerifyDateDialog(MainWindow owner) { GridBagConstraints gbc; GridBagLayout gbl; - setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); setMinimumSize(new Dimension(300, 200)); @@ -88,8 +87,8 @@ public VerifyDateDialog(MainWindow owner) { contentPane.setLayout(new GridBagLayout()); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.columnWeights = new double[]{1.0,1.0}; - gridBagLayout.rowWeights = new double[]{0.0, 1.0, 0.0}; + gridBagLayout.columnWeights = new double[] { 1.0, 1.0 }; + gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 0.0 }; contentPane.setLayout(gridBagLayout); JLabel lblNewLabel = new JLabel("Informations de progression"); @@ -101,17 +100,16 @@ public VerifyDateDialog(MainWindow owner) { gbc.insets = new Insets(5, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 0; - gbc.gridwidth=2; + gbc.gridwidth = 2; contentPane.add(lblNewLabel, gbc); - JScrollPane scrollPane = new JScrollPane(); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(0, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 1; - gbc.gridwidth=5; + gbc.gridwidth = 5; contentPane.add(scrollPane, gbc); extProgressTextArea = new JTextArea(); extProgressTextArea.setFont(MainWindow.LABEL_FONT); @@ -120,8 +118,6 @@ public VerifyDateDialog(MainWindow owner) { extProgressTextArea.setLineWrap(true); scrollPane.setViewportView(extProgressTextArea); - - JButton searchButton = new JButton(); searchButton.setIcon(new ImageIcon(getClass().getResource("/icon/search-system.png"))); searchButton.setText(""); @@ -162,8 +158,8 @@ public VerifyDateDialog(MainWindow owner) { previousButton.addActionListener(arg0 -> buttonPrevious()); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{0.0, 1.0}; - gbl.columnWidths = new int[]{30, 0}; + gbl.columnWeights = new double[] { 0.0, 1.0 }; + gbl.columnWidths = new int[] { 30, 0 }; JPanel choicePanel = new JPanel(gbl); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; @@ -173,8 +169,6 @@ public VerifyDateDialog(MainWindow owner) { gbc.anchor = GridBagConstraints.LINE_START; contentPane.add(choicePanel, gbc); - - JPanel resultPanel = new JPanel(); resultPanel.setLayout(new GridBagLayout()); resultPanel.setMinimumSize(new Dimension(150, 36)); @@ -196,17 +190,17 @@ public VerifyDateDialog(MainWindow owner) { prepareProgessLogger(); - - pack(); setLocationRelativeTo(owner); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - close(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + close(); + } } - }); + ); } private void prepareProgessLogger() { @@ -218,12 +212,19 @@ private void prepareProgessLogger() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - SEDALibProgressLogger spl = - new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { + SEDALibProgressLogger spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { String newLog = extProgressTextArea.getText() + "\n" + log; extProgressTextArea.setText(newLog); extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); } @@ -244,7 +245,13 @@ private void buttonSearch() { private void buttonNext() { if (searchArchiveUnitResult != null && searchArchiveUnitResult.size() > 0) { searchResultPosition = Math.min(searchResultPosition + 1, searchArchiveUnitResult.size() - 1); - resultArchiveUnitLabel.setText((searchResultPosition + 1) + "/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + (searchResultPosition + 1) + + "/" + + searchArchiveUnitResult.size() + + " trouvé" + + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); } } @@ -252,7 +259,13 @@ private void buttonNext() { private void buttonPrevious() { if (searchArchiveUnitResult != null && searchArchiveUnitResult.size() > 0) { searchResultPosition = Math.max(searchResultPosition - 1, 0); - resultArchiveUnitLabel.setText((searchResultPosition + 1) + "/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + (searchResultPosition + 1) + + "/" + + searchArchiveUnitResult.size() + + " trouvé" + + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(searchResultPosition)); } } @@ -266,10 +279,11 @@ public void setSearchArchiveUnitResult(List searchArchiveUnitResult this.searchArchiveUnitResult = searchArchiveUnitResult; searchResultPosition = 0; if (searchArchiveUnitResult.size() > 0) { - resultArchiveUnitLabel.setText("1/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "")); + resultArchiveUnitLabel.setText( + "1/" + searchArchiveUnitResult.size() + " trouvé" + (searchArchiveUnitResult.size() > 1 ? "s" : "") + ); ResipGraphicApp.getTheWindow().treePane.focusArchiveUnit(searchArchiveUnitResult.get(0)); - } else - resultArchiveUnitLabel.setText("0 trouvé"); + } else resultArchiveUnitLabel.setText("0 trouvé"); } /** diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java index ea0c8445..8eadc532 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/XmlEditDialog.java @@ -107,7 +107,8 @@ public class XmlEditDialog extends JDialog { * @throws NoSuchMethodException the no such method exception * @throws InvocationTargetException the invocation target exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { TestDialogWindow window = new TestDialogWindow(XmlEditDialog.class); } @@ -118,7 +119,7 @@ public static void main(String[] args) throws ClassNotFoundException, Unsupporte * @throws SEDALibException the seda lib exception */ public XmlEditDialog(JFrame owner) throws SEDALibException { - this(owner, createSEDAMetadataSample("AgentType","Writer",false)); + this(owner, createSEDAMetadataSample("AgentType", "Writer", false)); } /** @@ -140,13 +141,17 @@ public XmlEditDialog(JFrame owner, Object xmlObject) { presentationText = dataObject.getInDataObjectPackageId(); try { xmlData = dataObject.toSedaXmlFragments(); - xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(xmlData); + xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString(xmlData); } catch (Exception e) { - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Resip.InOut: Erreur à l'indentation du DataObject [" - + dataObject.getInDataObjectPackageId() + "]",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.InOut: Erreur à l'indentation du DataObject [" + + dataObject.getInDataObjectPackageId() + + "]", + e + ); } - } else if (xmlObject instanceof SEDAMetadata) { SEDAMetadata sm = (SEDAMetadata) xmlObject; title = "Edition partielle de métadonnées"; @@ -155,8 +160,12 @@ public XmlEditDialog(JFrame owner, Object xmlObject) { try { xmlData = sm.toString(); } catch (Exception e) { - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Resip.InOut: Erreur à la génération XML de la métadonnée [" - + sm.getXmlElementName() + "]",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.InOut: Erreur à la génération XML de la métadonnée [" + sm.getXmlElementName() + "]", + e + ); } } else if (xmlObject instanceof ArchiveUnit) { ArchiveUnit au = (ArchiveUnit) xmlObject; @@ -306,7 +315,7 @@ public XmlEditDialog(JFrame owner, Object xmlObject) { actionPanel.add(cleanButton, gbc); } - final JButton saveButton = new JButton((xmlObject instanceof String?"Valider":"Sauver")); + final JButton saveButton = new JButton((xmlObject instanceof String ? "Valider" : "Sauver")); saveButton.addActionListener(arg -> buttonSaveXmlEdit()); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 5); @@ -335,12 +344,14 @@ public XmlEditDialog(JFrame owner, Object xmlObject) { gbc.gridx = buttonPlace; actionPanel.add(cancelButton, gbc); - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - cancelButton.doClick(); + addWindowListener( + new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + cancelButton.doClick(); + } } - }); + ); pack(); informationPanel.setVisible(false); @@ -392,23 +403,39 @@ public void buttonIndent() { /** * The Default values. */ - static ArrayList defaultValues = new ArrayList(Arrays.asList("Text", - "1970-01-01", "1970-01-01T01:00:00", "Rule1", "Rule2", "Rule3", "Rule4", - "Level1", "Owner1", "Text1", "Text2")); + static ArrayList defaultValues = new ArrayList( + Arrays.asList( + "Text", + "1970-01-01", + "1970-01-01T01:00:00", + "Rule1", + "Rule2", + "Rule3", + "Rule4", + "Level1", + "Owner1", + "Text1", + "Text2" + ) + ); private String filterDefaultValues(SEDAXMLEventReader xmlReader) throws XMLStreamException { String result = "", tag, tmp, attrStr = ""; XMLEvent mainEvent, subEvent, tmpEvent; mainEvent = xmlReader.peekUsefullEvent(); - if (mainEvent.isEndElement()) - return null; + if (mainEvent.isEndElement()) return null; mainEvent = xmlReader.nextUsefullEvent(); tag = mainEvent.asStartElement().getName().getLocalPart(); Iterator attributes = mainEvent.asStartElement().getAttributes(); while (attributes.hasNext()) { Attribute attribute = attributes.next(); - attrStr += " " + (attribute.getName().getPrefix().equals("xml") ? "xml:" : "") + - attribute.getName().getLocalPart() + "=\"" + attribute.getValue() + "\""; + attrStr += + " " + + (attribute.getName().getPrefix().equals("xml") ? "xml:" : "") + + attribute.getName().getLocalPart() + + "=\"" + + attribute.getValue() + + "\""; } tmpEvent = xmlReader.peekUsefullEvent(); if (tmpEvent.isCharacters()) { @@ -425,8 +452,7 @@ private String filterDefaultValues(SEDAXMLEventReader xmlReader) throws XMLStrea } result += tmp; } - if (!result.isEmpty()) - result += ""; + if (!result.isEmpty()) result += ""; tmpEvent = xmlReader.nextUsefullEvent(); } return result; @@ -439,22 +465,24 @@ public void buttonClean() { String result = ""; try { // indent to verify XML format - String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(xmlTextArea.getText()); - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlDataString.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString( + xmlTextArea.getText() + ); + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlDataString.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); result = filterDefaultValues(xmlReader); XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new ResipException("Il y a des champs en trop"); + if (!event.isEndDocument()) throw new ResipException("Il y a des champs en trop"); } catch (XMLStreamException | SEDALibException | IOException e) { throw new ResipException("Erreur de lecture", e); } - if (!result.isEmpty()) - result = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(result); + if (!result.isEmpty()) result = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString( + result + ); xmlTextArea.setText(result); hideWarning(); xmlTextArea.setCaretPosition(0); @@ -469,8 +497,9 @@ private void buttonCancel() { private void buttonSaveXmlEdit() { try { - String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(xmlTextArea.getText()); + String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString( + xmlTextArea.getText() + ); if (xmlObject instanceof DataObject) { DataObject dataObject = (DataObject) xmlObject; dataObject.fromSedaXmlFragments(xmlDataString); @@ -482,8 +511,7 @@ private void buttonSaveXmlEdit() { ArchiveUnit au = (ArchiveUnit) xmlObject; au.fromSedaXmlFragments(xmlDataString); xmlObjectResult = au; - } - else if (xmlObject instanceof String) { + } else if (xmlObject instanceof String) { xmlObjectResult = xmlDataString; } informationTextArea.setForeground(Color.BLACK); @@ -496,16 +524,16 @@ else if (xmlObject instanceof String) { private void buttonCanonizeXmlEdit() { try { - String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(xmlTextArea.getText()); + String xmlDataString = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString( + xmlTextArea.getText() + ); ArchiveUnit au = new ArchiveUnit(); au.fromSedaXmlFragments(xmlDataString); au.getContent(); au.getManagement(); au.getArchiveUnitProfile(); String xmlData = au.toSedaXmlFragments(); - xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT) - .indentString(xmlData); + xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString(xmlData); xmlTextArea.setText(xmlData); informationTextArea.setForeground(Color.BLACK); informationTextArea.setText(""); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java index 845e880a..dcd7e56d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.frame; \ No newline at end of file +package fr.gouv.vitam.tools.resip.frame; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java index 2cc9e5d5..72d7b474 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/PreferencesDialog.java @@ -174,11 +174,44 @@ public class PreferencesDialog extends JDialog { /** * The proposed charsets. */ - private static final String[] charsetStrings = {"windows-1252", "ISO-8859-1", "UTF-8", "CESU-8", "IBM00858", "IBM437", "IBM775", - "IBM850", "IBM852", "IBM855", "IBM857", "IBM862", "IBM866", "ISO-8859-2", "ISO-8859-4", "ISO-8859-5", - "ISO-8859-7", "ISO-8859-9", "ISO-8859-13", "ISO-8859-15", "KOI8-R", "KOI8-U", "US-ASCII", "UTF-16", - "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE", "x-UTF-32BE-BOM", "x-UTF-32LE-BOM", - "windows-1250", "windows-1251", "windows-1253", "windows-1254", "windows-1257"}; + private static final String[] charsetStrings = { + "windows-1252", + "ISO-8859-1", + "UTF-8", + "CESU-8", + "IBM00858", + "IBM437", + "IBM775", + "IBM850", + "IBM852", + "IBM855", + "IBM857", + "IBM862", + "IBM866", + "ISO-8859-2", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-7", + "ISO-8859-9", + "ISO-8859-13", + "ISO-8859-15", + "KOI8-R", + "KOI8-U", + "US-ASCII", + "UTF-16", + "UTF-16BE", + "UTF-16LE", + "UTF-32", + "UTF-32BE", + "UTF-32LE", + "x-UTF-32BE-BOM", + "x-UTF-32LE-BOM", + "windows-1250", + "windows-1251", + "windows-1253", + "windows-1254", + "windows-1257", + }; private SedaVersion currentVersion; @@ -197,10 +230,11 @@ public class PreferencesDialog extends JDialog { * @throws ResipException the resip exception * @throws InterruptedException the interrupted exception */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { - ResipGraphicApp rga = new ResipGraphicApp(null);//NOSONAR used for debug run + public static void main(String[] args) + throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ResipException, InterruptedException { + ResipGraphicApp rga = new ResipGraphicApp(null); //NOSONAR used for debug run Thread.sleep(1000); - TestDialogWindow window = new TestDialogWindow(PreferencesDialog.class);//NOSONAR used for debug run + TestDialogWindow window = new TestDialogWindow(PreferencesDialog.class); //NOSONAR used for debug run } /** @@ -210,7 +244,6 @@ public static void main(String[] args) throws ClassNotFoundException, Unsupporte */ public PreferencesDialog(JFrame owner) { super(owner, "Edition des paramètres par défaut", true); - EventBus.subscribe(SedaVersionChangedEvent.class, event -> { this.currentVersion = event.getNewVersion(); }); @@ -230,8 +263,8 @@ public PreferencesDialog(JFrame owner) { Container contentPane = getContentPane(); GridBagLayout gridBagLayout = new GridBagLayout(); - gridBagLayout.rowWeights = new double[]{1.0, 0.1}; - gridBagLayout.columnWeights = new double[]{1.0, 1.0}; + gridBagLayout.rowWeights = new double[] { 1.0, 0.1 }; + gridBagLayout.columnWeights = new double[] { 1.0, 1.0 }; contentPane.setLayout(new GridBagLayout()); GridBagConstraints gbc; @@ -249,12 +282,17 @@ public PreferencesDialog(JFrame owner) { // header and footer simple fields JPanel headerFooterSimplePanel = new JPanel(); - tabbedPane.addTab("Métadonnées globales", new ImageIcon(getClass().getResource("/icon/document-properties.png")), headerFooterSimplePanel, null); + tabbedPane.addTab( + "Métadonnées globales", + new ImageIcon(getClass().getResource("/icon/document-properties.png")), + headerFooterSimplePanel, + null + ); GridBagLayout gblHeaderFooterSimplePanel = new GridBagLayout(); - gblHeaderFooterSimplePanel.columnWidths = new int[]{0, 0, 0}; - gblHeaderFooterSimplePanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; - gblHeaderFooterSimplePanel.columnWeights = new double[]{0.0, 1.0, 0.0}; - gblHeaderFooterSimplePanel.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; + gblHeaderFooterSimplePanel.columnWidths = new int[] { 0, 0, 0 }; + gblHeaderFooterSimplePanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + gblHeaderFooterSimplePanel.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gblHeaderFooterSimplePanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }; headerFooterSimplePanel.setLayout(gblHeaderFooterSimplePanel); JLabel presentationLabel = new JLabel("Champs globaux du SIP"); @@ -398,7 +436,9 @@ public PreferencesDialog(JFrame owner) { headerFooterSimplePanel.add(lblTransferringAgencyIdentifier, gbc); transferringAgencyIdentifierTextField = new JTextField(); - transferringAgencyIdentifierTextField.setText(gmc.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier); + transferringAgencyIdentifierTextField.setText( + gmc.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier + ); transferringAgencyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 5); @@ -411,12 +451,17 @@ public PreferencesDialog(JFrame owner) { // Header and footer complex fields JPanel headerFooterComplexPanel = new JPanel(); - tabbedPane.addTab("Métadonnées globales étendues", new ImageIcon(getClass().getResource("/icon/text-x-generic.png")), headerFooterComplexPanel, null); + tabbedPane.addTab( + "Métadonnées globales étendues", + new ImageIcon(getClass().getResource("/icon/text-x-generic.png")), + headerFooterComplexPanel, + null + ); GridBagLayout gblHeaderFooterComplexPanel = new GridBagLayout(); - gblHeaderFooterComplexPanel.columnWidths = new int[]{0, 0, 0}; - gblHeaderFooterComplexPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0}; - gblHeaderFooterComplexPanel.columnWeights = new double[]{0.0, 1.0, 0.0}; - gblHeaderFooterComplexPanel.rowWeights = new double[]{0.0, 1.0, 1.0, 0.0, 0.5, 0.5, 0.0}; + gblHeaderFooterComplexPanel.columnWidths = new int[] { 0, 0, 0 }; + gblHeaderFooterComplexPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0 }; + gblHeaderFooterComplexPanel.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gblHeaderFooterComplexPanel.rowWeights = new double[] { 0.0, 1.0, 1.0, 0.0, 0.5, 0.5, 0.0 }; headerFooterComplexPanel.setLayout(gblHeaderFooterComplexPanel); JLabel presentationComplexLabel = new JLabel("Champs globaux étendus du SIP"); @@ -490,26 +535,28 @@ public PreferencesDialog(JFrame owner) { transferRequestReplyIdentifierTextField = new JTextField(); transferRequestReplyIdentifierTextField.setFont(MainWindow.DETAILS_FONT); - transferRequestReplyIdentifierTextField.setText(gmc.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier); + transferRequestReplyIdentifierTextField.setText( + gmc.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier + ); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 5); gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 3; - headerFooterComplexPanel.add(transferRequestReplyIdentifierTextField, - gbc); + headerFooterComplexPanel.add(transferRequestReplyIdentifierTextField, gbc); transferRequestReplyIdentifierTextField.setColumns(10); JLabel archivalAgencyOrganizationDescriptiveMetadataLabel = new JLabel("Détails sur l'acteur d'archivage :"); - archivalAgencyOrganizationDescriptiveMetadataLabel.setToolTipText("Bloc XML OrganisationDescriptiveMetadata de la métadonnée ArchivalAgency "); + archivalAgencyOrganizationDescriptiveMetadataLabel.setToolTipText( + "Bloc XML OrganisationDescriptiveMetadata de la métadonnée ArchivalAgency " + ); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 4; - headerFooterComplexPanel.add(archivalAgencyOrganizationDescriptiveMetadataLabel, - gbc); + headerFooterComplexPanel.add(archivalAgencyOrganizationDescriptiveMetadataLabel, gbc); JScrollPane scrollPane3 = new JScrollPane(); gbc = new GridBagConstraints(); @@ -523,19 +570,23 @@ public PreferencesDialog(JFrame owner) { archivalAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); archivalAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane3.setViewportView(archivalAgencyOrganizationDescriptiveMetadataTextArea); - archivalAgencyOrganizationDescriptiveMetadataTextArea - .setText(gmc.getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData); + archivalAgencyOrganizationDescriptiveMetadataTextArea.setText( + gmc.getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData + ); archivalAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); - JLabel transferringAgencyOrganizationDescriptiveMetadataLabel = new JLabel("Détails sur l'acteur de transfert :"); - transferringAgencyOrganizationDescriptiveMetadataLabel.setToolTipText("Bloc XML OrganisationDescriptiveMetadata de la métadonnée TransferringAgency "); + JLabel transferringAgencyOrganizationDescriptiveMetadataLabel = new JLabel( + "Détails sur l'acteur de transfert :" + ); + transferringAgencyOrganizationDescriptiveMetadataLabel.setToolTipText( + "Bloc XML OrganisationDescriptiveMetadata de la métadonnée TransferringAgency " + ); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 5, 5, 5); gbc.gridx = 0; gbc.gridy = 5; - headerFooterComplexPanel.add(transferringAgencyOrganizationDescriptiveMetadataLabel, - gbc); + headerFooterComplexPanel.add(transferringAgencyOrganizationDescriptiveMetadataLabel, gbc); JScrollPane scrollPane4 = new JScrollPane(); gbc = new GridBagConstraints(); @@ -549,17 +600,23 @@ public PreferencesDialog(JFrame owner) { transferringAgencyOrganizationDescriptiveMetadataTextArea = new JTextArea(); transferringAgencyOrganizationDescriptiveMetadataTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane4.setViewportView(transferringAgencyOrganizationDescriptiveMetadataTextArea); - transferringAgencyOrganizationDescriptiveMetadataTextArea - .setText(gmc.getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData); + transferringAgencyOrganizationDescriptiveMetadataTextArea.setText( + gmc.getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData + ); transferringAgencyOrganizationDescriptiveMetadataTextArea.setCaretPosition(0); // ExportParameters Panel JPanel exportParametersPanel = new JPanel(); - tabbedPane.addTab("Export", new ImageIcon(getClass().getResource("/icon/document-save.png")), exportParametersPanel, null); + tabbedPane.addTab( + "Export", + new ImageIcon(getClass().getResource("/icon/document-save.png")), + exportParametersPanel, + null + ); GridBagLayout gblExportParametersPanel = new GridBagLayout(); - gblExportParametersPanel.columnWeights = new double[]{0, 0.5, 0.5, 0}; - gblExportParametersPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; - gblExportParametersPanel.rowWeights = new double[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}; + gblExportParametersPanel.columnWeights = new double[] { 0, 0.5, 0.5, 0 }; + gblExportParametersPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + gblExportParametersPanel.rowWeights = new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; exportParametersPanel.setLayout(gblExportParametersPanel); JLabel inSIPLabel = new JLabel("Options de formation du SIP"); @@ -602,10 +659,8 @@ public PreferencesDialog(JFrame owner) { hierarchicalAUButtonGroup.add(flatRadioButton); hierarchicalAUButtonGroup.add(hierarchicalRadioButton); hierarchicalAUButtonGroup.clearSelection(); - if (gmc.isHierarchicalArchiveUnits()) - hierarchicalRadioButton.setSelected(true); - else - flatRadioButton.setSelected(true); + if (gmc.isHierarchicalArchiveUnits()) hierarchicalRadioButton.setSelected(true); + else flatRadioButton.setSelected(true); JLabel xmlPresentationLabel = new JLabel("Présentation XML dans le SIP:"); gbc = new GridBagConstraints(); @@ -634,10 +689,8 @@ public PreferencesDialog(JFrame owner) { indentedButtonGroup.add(linearRadioButton); indentedButtonGroup.add(indentedRadioButton); indentedButtonGroup.clearSelection(); - if (gmc.isIndented()) - indentedRadioButton.setSelected(true); - else - linearRadioButton.setSelected(true); + if (gmc.isIndented()) indentedRadioButton.setSelected(true); + else linearRadioButton.setSelected(true); JLabel xmlReindexLabel = new JLabel("Renumérotation des éléments XML avant export:"); gbc = new GridBagConstraints(); @@ -667,10 +720,8 @@ public PreferencesDialog(JFrame owner) { reindexButtonGroup.add(reindexYesRadioButton); reindexButtonGroup.add(reindexNoRadioButton); reindexButtonGroup.clearSelection(); - if (gmc.isReindex()) - reindexYesRadioButton.setSelected(true); - else - reindexNoRadioButton.setSelected(true); + if (gmc.isReindex()) reindexYesRadioButton.setSelected(true); + else reindexNoRadioButton.setSelected(true); JLabel inCSVLabel = new JLabel("Options d'export en hiérarchie simplifiée et fichier csv"); inCSVLabel.setFont(MainWindow.BOLD_LABEL_FONT); @@ -800,12 +851,15 @@ public PreferencesDialog(JFrame owner) { metadataFilterTextArea = new JTextArea(); metadataFilterTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane.setViewportView(metadataFilterTextArea); - if (gmc.getKeptMetadataList() != null) - metadataFilterTextArea.setText(String.join("\n", String.join("\n", gmc.getKeptMetadataList()))); + if (gmc.getKeptMetadataList() != null) metadataFilterTextArea.setText( + String.join("\n", String.join("\n", gmc.getKeptMetadataList())) + ); metadataFilterTextArea.setCaretPosition(0); metadataFilterCheckBox = new JCheckBox("Seules métadonnées exportées :"); - metadataFilterCheckBox.setToolTipText("Liste des noms de métadonnées dans , utilisée comm filtre si coché "); + metadataFilterCheckBox.setToolTipText( + "Liste des noms de métadonnées dans , utilisée comm filtre si coché " + ); metadataFilterCheckBox.setSelected(gmc.isMetadataFilterFlag()); metadataFilterTextArea.setEnabled(gmc.isMetadataFilterFlag()); gbc = new GridBagConstraints(); @@ -820,9 +874,14 @@ public PreferencesDialog(JFrame owner) { // ImportParameters Panel JPanel importParametersPanel = new JPanel(); - tabbedPane.addTab("Import", new ImageIcon(getClass().getResource("/icon/document-open.png")), importParametersPanel, null); + tabbedPane.addTab( + "Import", + new ImageIcon(getClass().getResource("/icon/document-open.png")), + importParametersPanel, + null + ); GridBagLayout gblImportParametersPanel = new GridBagLayout(); - gblImportParametersPanel.columnWeights = new double[]{0.1, 0.1, 0.5, 0.1}; + gblImportParametersPanel.columnWeights = new double[] { 0.1, 0.1, 0.5, 0.1 }; importParametersPanel.setLayout(gblImportParametersPanel); JLabel mailImportLabel = new JLabel("Import des messageries"); @@ -950,11 +1009,14 @@ public PreferencesDialog(JFrame owner) { ignorePatternsTextArea = new JTextArea(); ignorePatternsTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane5.setViewportView(ignorePatternsTextArea); - if (dic.getIgnorePatternList() != null) - ignorePatternsTextArea.setText(String.join("\n", String.join("\n", dic.getIgnorePatternList()))); + if (dic.getIgnorePatternList() != null) ignorePatternsTextArea.setText( + String.join("\n", String.join("\n", dic.getIgnorePatternList())) + ); JLabel ignorePatternsLabel = new JLabel("Fichiers exclus des imports :"); - ignorePatternsLabel.setToolTipText("Liste d'expressions régulières définissant les noms de fichiers à ne pas prendre en compte"); + ignorePatternsLabel.setToolTipText( + "Liste d'expressions régulières définissant les noms de fichiers à ne pas prendre en compte" + ); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 5, 5, 5); @@ -1028,11 +1090,16 @@ public PreferencesDialog(JFrame owner) { if (ResipGraphicApp.getTheApp().interfaceParameters.isExperimentalFlag()) { // CompactParameters Panel JPanel compactParametersPanel = new JPanel(); - tabbedPane.addTab("Compact", new ImageIcon(getClass().getResource("/icon/package-x-generic.png")), compactParametersPanel, null); + tabbedPane.addTab( + "Compact", + new ImageIcon(getClass().getResource("/icon/package-x-generic.png")), + compactParametersPanel, + null + ); GridBagLayout gblCompactParametersPanel = new GridBagLayout(); - gblCompactParametersPanel.columnWeights = new double[]{0.20, 0.15, 0.25, 0.15, 0.25}; - gblCompactParametersPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; - gblCompactParametersPanel.rowWeights = new double[]{0, 0, 0, 0.4, 0, 0, 0, 1}; + gblCompactParametersPanel.columnWeights = new double[] { 0.20, 0.15, 0.25, 0.15, 0.25 }; + gblCompactParametersPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + gblCompactParametersPanel.rowWeights = new double[] { 0, 0, 0, 0.4, 0, 0, 0, 1 }; compactParametersPanel.setLayout(gblCompactParametersPanel); JLabel compactLabel = new JLabel("Limites des paquets de documents"); @@ -1121,8 +1188,11 @@ public PreferencesDialog(JFrame owner) { compactDocumentDataObjectVersionFilterTextArea = new JTextArea(); compactDocumentDataObjectVersionFilterTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane.setViewportView(compactDocumentDataObjectVersionFilterTextArea); - if (coc.getDocumentKeptDataObjectVersionList() != null) - compactDocumentDataObjectVersionFilterTextArea.setText(String.join("\n", String.join("\n", coc.getDocumentKeptDataObjectVersionList()))); + if ( + coc.getDocumentKeptDataObjectVersionList() != null + ) compactDocumentDataObjectVersionFilterTextArea.setText( + String.join("\n", String.join("\n", coc.getDocumentKeptDataObjectVersionList())) + ); compactDocumentDataObjectVersionFilterTextArea.setCaretPosition(0); compactLabel = new JLabel("Sous-documents:"); @@ -1145,8 +1215,11 @@ public PreferencesDialog(JFrame owner) { compactSubDocumentDataObjectVersionFilterTextArea = new JTextArea(); compactSubDocumentDataObjectVersionFilterTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane.setViewportView(compactSubDocumentDataObjectVersionFilterTextArea); - if (coc.getSubDocumentKeptDataObjectVersionList() != null) - compactSubDocumentDataObjectVersionFilterTextArea.setText(String.join("\n", String.join("\n", coc.getSubDocumentKeptDataObjectVersionList()))); + if ( + coc.getSubDocumentKeptDataObjectVersionList() != null + ) compactSubDocumentDataObjectVersionFilterTextArea.setText( + String.join("\n", String.join("\n", coc.getSubDocumentKeptDataObjectVersionList())) + ); compactSubDocumentDataObjectVersionFilterTextArea.setCaretPosition(0); compactLabel = new JLabel("Mode de construction des paquets de documents"); @@ -1180,10 +1253,8 @@ public PreferencesDialog(JFrame owner) { arcMethodButtonGroup.add(zipRadioButton); arcMethodButtonGroup.add(tarRadioButton); arcMethodButtonGroup.clearSelection(); - if (coc.isDeflatedFlag()) - zipRadioButton.setSelected(true); - else - tarRadioButton.setSelected(true); + if (coc.isDeflatedFlag()) zipRadioButton.setSelected(true); + else tarRadioButton.setSelected(true); compactLabel = new JLabel("Filtrage des métadonnées"); compactLabel.setFont(MainWindow.BOLD_LABEL_FONT); @@ -1210,12 +1281,15 @@ public PreferencesDialog(JFrame owner) { compactMetadataFilterTextArea = new JTextArea(); compactMetadataFilterTextArea.setFont(MainWindow.DETAILS_FONT); scrollPane.setViewportView(compactMetadataFilterTextArea); - if (coc.getKeptMetadataList() != null) - compactMetadataFilterTextArea.setText(String.join("\n", String.join("\n", coc.getKeptMetadataList()))); + if (coc.getKeptMetadataList() != null) compactMetadataFilterTextArea.setText( + String.join("\n", String.join("\n", coc.getKeptMetadataList())) + ); compactMetadataFilterTextArea.setCaretPosition(0); compactMetadataFilterCheckBox = new JCheckBox("Seules métadonnées compactées :"); - compactMetadataFilterCheckBox.setToolTipText("Liste des noms de métadonnées dans , utilisée comm filtre si coché "); + compactMetadataFilterCheckBox.setToolTipText( + "Liste des noms de métadonnées dans , utilisée comm filtre si coché " + ); compactMetadataFilterCheckBox.setSelected(coc.isMetadataFilterFlag()); compactMetadataFilterTextArea.setEnabled(coc.isMetadataFilterFlag()); gbc = new GridBagConstraints(); @@ -1230,11 +1304,15 @@ public PreferencesDialog(JFrame owner) { // TreatmentParameters Panel JPanel treatmentParametersPanel = new JPanel(); - tabbedPane.addTab("Traitement/Interface", new ImageIcon(getClass().getResource("/icon/edit-find-replace.png")), - treatmentParametersPanel, null); + tabbedPane.addTab( + "Traitement/Interface", + new ImageIcon(getClass().getResource("/icon/edit-find-replace.png")), + treatmentParametersPanel, + null + ); GridBagLayout gblTreatmentParametersPanel = new GridBagLayout(); - gblTreatmentParametersPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0}; - gblTreatmentParametersPanel.rowWeights = new double[]{0, 0, 0, 0, 0, 0, 0, 0, 1.0}; + gblTreatmentParametersPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gblTreatmentParametersPanel.rowWeights = new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 1.0 }; treatmentParametersPanel.setLayout(gblTreatmentParametersPanel); JLabel workDirLabel = new JLabel("Répertoire de travail"); @@ -1373,10 +1451,8 @@ public PreferencesDialog(JFrame owner) { interfaceTypeButtonGroup.add(classicInterfaceRadioButton); interfaceTypeButtonGroup.add(structuredInterfaceRadioButton); interfaceTypeButtonGroup.clearSelection(); - if (ip.isStructuredMetadataEditionFlag()) - structuredInterfaceRadioButton.setSelected(true); - else - classicInterfaceRadioButton.setSelected(true); + if (ip.isStructuredMetadataEditionFlag()) structuredInterfaceRadioButton.setSelected(true); + else classicInterfaceRadioButton.setSelected(true); JLabel debugModeLabel = new JLabel("Modes spécifiques:"); gbc = new GridBagConstraints(); @@ -1430,6 +1506,7 @@ public PreferencesDialog(JFrame owner) { pack(); setLocationRelativeTo(owner); } + // actions private void metadataFilterEvent(ItemEvent event) { @@ -1454,8 +1531,7 @@ private void buttonCancel() { } private void buttonOk() { - if (!extractFromDialog()) - return; + if (!extractFromDialog()) return; returnValue = OK_DIALOG; setVisible(false); } @@ -1463,29 +1539,30 @@ private void buttonOk() { private String chooseDirectory() { JFileChooser fileChooser = new JFileChooser(cc.getWorkDir()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) - try { - return fileChooser.getSelectedFile().getCanonicalPath(); - } catch (IOException e) { - return null; - } + if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) try { + return fileChooser.getSelectedFile().getCanonicalPath(); + } catch (IOException e) { + return null; + } return null; } private void buttonChooseWorkDir() { try { String dir = chooseDirectory(); - if (dir == null) - return; + if (dir == null) return; workDirTextField.setText(dir); } catch (Exception e) { - UserInteractionDialog.getUserAnswer(this.owner, - "Erreur fatale, impossible de sélectionner sur le disque \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, - "Resip.GraphicApp: Erreur fatale, impossible de sélectionner sur le disque", e); + UserInteractionDialog.getUserAnswer( + this.owner, + "Erreur fatale, impossible de sélectionner sur le disque \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log(ResipLogger.ERROR, "Resip.GraphicApp: Erreur fatale, impossible de sélectionner sur le disque", e); } } @@ -1526,10 +1603,9 @@ private void updateApplicationState(DataObjectPackage convertedPackage) { ResipGraphicApp.getTheWindow().load(); } - private int getPositiveInt(String numberString){ + private int getPositiveInt(String numberString) { int result = Integer.parseInt(numberString); - if (result <= 0) - throw new NumberFormatException("Number not strictly positive"); + if (result <= 0) throw new NumberFormatException("Number not strictly positive"); return result; } @@ -1552,28 +1628,32 @@ private boolean extractFromDialog() { gmc.setHierarchicalArchiveUnits(hierarchicalRadioButton.isSelected()); gmc.setIndented(indentedRadioButton.isSelected()); gmc.setReindex(reindexYesRadioButton.isSelected()); - if (firstUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(FIRST_DATAOBJECT); - else if (allUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(ALL_DATAOBJECTS); - else if (lastUsageButton.isSelected()) - gmc.setUsageVersionSelectionMode(LAST_DATAOBJECT); + if (firstUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(FIRST_DATAOBJECT); + else if (allUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(ALL_DATAOBJECTS); + else if (lastUsageButton.isSelected()) gmc.setUsageVersionSelectionMode(LAST_DATAOBJECT); try { tmp = getPositiveInt(nameMaxSizeTextField.getText()); } catch (NumberFormatException e) { tabbedPane.setSelectedIndex(3); - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "La taille limite des noms de répertoires exportées doit être un nombre strictement supérieur à 0.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "La taille limite des noms de répertoires exportées doit être un nombre strictement supérieur à 0.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return false; } gmc.setMaxNameSize(tmp); gmc.setCsvExtendedFormat(csvExtendedFormatChexBox.isSelected()); gmc.setManagementMetadataXmlData(managementMetadataTextArea.getText()); gmc.setMetadataFilterFlag(metadataFilterCheckBox.isSelected()); - gmc.setKeptMetadataList(Arrays.asList(metadataFilterTextArea.getText().split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList())); + gmc.setKeptMetadataList( + Arrays.asList(metadataFilterTextArea.getText().split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()) + ); gmc.getArchiveTransferGlobalMetadata().comment = commentTextArea.getText(); gmc.getArchiveTransferGlobalMetadata().date = dateTextField.getText(); @@ -1581,13 +1661,15 @@ else if (lastUsageButton.isSelected()) gmc.getArchiveTransferGlobalMetadata().messageIdentifier = messageIdentifierTextField.getText(); gmc.getArchiveTransferGlobalMetadata().archivalAgreement = archivalAgreementTextField.getText(); gmc.getArchiveTransferGlobalMetadata().codeListVersionsXmlData = clvTextArea.getText(); - gmc.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier = transferRequestReplyIdentifierTextField.getText(); + gmc.getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier = + transferRequestReplyIdentifierTextField.getText(); gmc.getArchiveTransferGlobalMetadata().archivalAgencyIdentifier = archivalAgencyIdentifierTextField.getText(); gmc.getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData = - archivalAgencyOrganizationDescriptiveMetadataTextArea.getText(); - gmc.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier = transferringAgencyIdentifierTextField.getText(); + archivalAgencyOrganizationDescriptiveMetadataTextArea.getText(); + gmc.getArchiveTransferGlobalMetadata().transferringAgencyIdentifier = + transferringAgencyIdentifierTextField.getText(); gmc.getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData = - transferringAgencyOrganizationDescriptiveMetadataTextArea.getText(); + transferringAgencyOrganizationDescriptiveMetadataTextArea.getText(); cic.setDelimiter((csvDelimiterTextField.getText().isEmpty() ? ';' : csvDelimiterTextField.getText().charAt(0))); cic.setCsvCharsetName((String) csvCharsetCombobox.getSelectedItem()); @@ -1595,37 +1677,53 @@ else if (lastUsageButton.isSelected()) if (ResipGraphicApp.getTheApp().interfaceParameters.isExperimentalFlag()) { try { tmp = Integer.parseInt(maxMetadataSizeTextField.getText()); - if (tmp < 0) - throw new NumberFormatException("Number not strictly positive"); + if (tmp < 0) throw new NumberFormatException("Number not strictly positive"); } catch (NumberFormatException e) { tabbedPane.setSelectedIndex(3); - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "La taille limite des métadonnées exportées doit être un nombre supérieur à 0. A noter, 0 veut dire sans limite.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "La taille limite des métadonnées exportées doit être un nombre supérieur à 0. A noter, 0 veut dire sans limite.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return false; } coc.setMaxMetadataSize(tmp); try { tmp = Integer.parseInt(maxDocumentNumberTextField.getText()); - if (tmp < 0) - throw new NumberFormatException("Number not strictly positive"); + if (tmp < 0) throw new NumberFormatException("Number not strictly positive"); } catch (NumberFormatException e) { tabbedPane.setSelectedIndex(3); - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Le nombre limite de documents dans un paquet doit être un nombre supérieur à 0. A noter, 0 veut dire sans limite.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Le nombre limite de documents dans un paquet doit être un nombre supérieur à 0. A noter, 0 veut dire sans limite.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return false; } coc.setMaxDocumentNumber(tmp); coc.setMetadataFilterFlag(compactMetadataFilterCheckBox.isSelected()); - coc.setDocumentKeptDataObjectVersionList(Arrays.asList(compactDocumentDataObjectVersionFilterTextArea.getText().split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList())); - coc.setSubDocumentKeptDataObjectVersionList(Arrays.asList(compactSubDocumentDataObjectVersionFilterTextArea.getText().split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList())); - coc.setKeptMetadataList(Arrays.asList(compactMetadataFilterTextArea.getText().split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList())); + coc.setDocumentKeptDataObjectVersionList( + Arrays.asList(compactDocumentDataObjectVersionFilterTextArea.getText().split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()) + ); + coc.setSubDocumentKeptDataObjectVersionList( + Arrays.asList(compactSubDocumentDataObjectVersionFilterTextArea.getText().split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()) + ); + coc.setKeptMetadataList( + Arrays.asList(compactMetadataFilterTextArea.getText().split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()) + ); coc.setDeflatedFlag(zipRadioButton.isSelected()); } @@ -1633,23 +1731,24 @@ else if (lastUsageButton.isSelected()) tmp = getPositiveInt(dupMaxTextField.getText()); } catch (NumberFormatException e) { tabbedPane.setSelectedIndex(4); - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "La valeur limite d'aggrégation des doublons doit être un nombre strictement supérieur à 0.", - "Information", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "La valeur limite d'aggrégation des doublons doit être un nombre strictement supérieur à 0.", + "Information", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return false; } tp.setDupMax(tmp); SedaVersion selectedVersion = sedaVersionSelector.getSelectedVersion(); - if (!selectedVersion.equals(currentVersion) - && ResipGraphicApp.getTheApp().currentWork != null) { - + if (!selectedVersion.equals(currentVersion) && ResipGraphicApp.getTheApp().currentWork != null) { String message = String.format( "Attention, un SIP est actuellement ouvert en version %s.\n" + - "Vous avez sélectionné la version %s.\n" + - "Voulez-vous essayer de convertir le SIP vers cette nouvelle version ?", + "Vous avez sélectionné la version %s.\n" + + "Voulez-vous essayer de convertir le SIP vers cette nouvelle version ?", currentVersion.toString(), selectedVersion.toString() ); @@ -1662,11 +1761,9 @@ else if (lastUsageButton.isSelected()) null ); - if (userChoice != OK_DIALOG) - return false; + if (userChoice != OK_DIALOG) return false; - if (!tryToConvertCurrentWorkSedaVersion(currentVersion, selectedVersion)) - return false; + if (!tryToConvertCurrentWorkSedaVersion(currentVersion, selectedVersion)) return false; } EventBus.publish(new SedaVersionChangedEvent(selectedVersion)); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java index de97fed5..b4ad627e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaConversionErrorHandler.java @@ -41,7 +41,6 @@ import fr.gouv.vitam.tools.resip.utils.ResipLogger; import javax.swing.JFrame; -import java.awt.Window; public class SedaConversionErrorHandler { @@ -59,27 +58,30 @@ public void handleFatalError(String versionLabel, Exception exception, Throwable UserInteractionDialog.ERROR_DIALOG, null ); - ResipLogger.getGlobalLogger().log( - ResipLogger.ERROR, - "resip.graphicapp: erreur fatale, impossible de faire la conversion en " + versionLabel, - threadError - ); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.ERROR, + "resip.graphicapp: erreur fatale, impossible de faire la conversion en " + versionLabel, + threadError + ); } public void handleNullResult(String versionLabel, Throwable error) { UserInteractionDialog.getUserAnswer( owner, - "Impossible de faire la conversion en " + versionLabel + - "\nFermez cet objet avant de changer la version du SEDA utilisé\n->" + error, + "Impossible de faire la conversion en " + + versionLabel + + "\nFermez cet objet avant de changer la version du SEDA utilisé\n->" + + error, "Erreur", UserInteractionDialog.ERROR_DIALOG, null ); - ResipLogger.getGlobalLogger().log( - ResipLogger.ERROR, - "resip.graphicapp: erreur, impossible de faire la conversion en " + versionLabel, - error - ); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.ERROR, + "resip.graphicapp: erreur, impossible de faire la conversion en " + versionLabel, + error + ); } } - diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java index 207d1859..d879b9d1 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/frame/preferences/SedaVersionSelector.java @@ -74,7 +74,8 @@ private void initializeButtons(SedaVersion selectedVersion) { } public SedaVersion getSelectedVersion() { - return versionButtons.entrySet() + return versionButtons + .entrySet() .stream() .filter(entry -> entry.getValue().isSelected()) .map(Map.Entry::getKey) @@ -93,4 +94,3 @@ public Map getVersionButtons() { return versionButtons; } } - diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java index aa92df10..4a9b3723 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/MailImporter.java @@ -61,8 +61,7 @@ public class MailImporter { */ Instant start, /** * The End. - */ - end; + */end; /** * The protocol. @@ -123,17 +122,37 @@ public class MailImporter { * @param target the work dir * @param mailExtractProgressLogger the logge */ - public MailImporter(boolean extractMessageTextFile, boolean extractMessageTextMetadata, - boolean extractAttachmentTextFile, boolean extractAttachmentMetadata, String protocol, String defaultCharsetName, String container, - String mailfolder, String target, MailExtractProgressLogger mailExtractProgressLogger) { + public MailImporter( + boolean extractMessageTextFile, + boolean extractMessageTextMetadata, + boolean extractAttachmentTextFile, + boolean extractAttachmentMetadata, + String protocol, + String defaultCharsetName, + String container, + String mailfolder, + String target, + MailExtractProgressLogger mailExtractProgressLogger + ) { this.protocol = protocol; this.container = container; this.urlString = StoreExtractor.composeStoreURL(protocol, null, null, null, container); this.mailfolder = mailfolder; this.summary = null; - this.storeExtractorOptions = new StoreExtractorOptions(true, true, ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag(), 12, defaultCharsetName, true, extractMessageTextFile, - extractMessageTextMetadata, extractAttachmentTextFile, extractAttachmentMetadata, 2); + this.storeExtractorOptions = new StoreExtractorOptions( + true, + true, + ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag(), + 12, + defaultCharsetName, + true, + extractMessageTextFile, + extractMessageTextMetadata, + extractAttachmentTextFile, + extractAttachmentMetadata, + 2 + ); this.target = target; this.mailExtractProgressLogger = mailExtractProgressLogger; } @@ -145,9 +164,8 @@ public MailImporter(boolean extractMessageTextFile, boolean extractMessageTextMe * @return the string */ private static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -161,13 +179,18 @@ public void doExtract() throws ResipException { try { start = Instant.now(); - storeExtractor = StoreExtractor.createStoreExtractor(urlString, mailfolder, target, - storeExtractorOptions, mailExtractProgressLogger); + storeExtractor = StoreExtractor.createStoreExtractor( + urlString, + mailfolder, + target, + storeExtractorOptions, + mailExtractProgressLogger + ); storeExtractor.extractAllFolders(); summary = "Extraction " + storeExtractor.getSummary(); storeExtractor.endStoreExtractor(); end = Instant.now(); - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, getSummary(),null); + ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, getSummary(), null); } catch (Exception e) { throw new ResipException("Erreur d'extraction", e); } @@ -182,17 +205,24 @@ public String getSummary() { String result = "resip: extraction depuis un conteneur courriel sur disque\n"; result += "en [" + container + "]\n"; result += "encodé selon le format [" + protocol + "]\n"; - result += "génération de fichier en forme texte des messages: " - + (storeExtractorOptions.extractMessageTextFile ? "oui" : "non") + "\n"; - result += "extraction des métadonnées texte des messages: " - + (storeExtractorOptions.extractMessageTextMetadata ? "oui" : "non") + "\n"; - result += "génération de fichier en forme texte des pièces jointes: " - + (storeExtractorOptions.extractFileTextFile ? "oui" : "non") + "\n"; - result += "extraction des métadonnées texte des pièces jointes: " - + (storeExtractorOptions.extractFileTextMetadata ? "oui" : "non") + "\n"; + result += + "génération de fichier en forme texte des messages: " + + (storeExtractorOptions.extractMessageTextFile ? "oui" : "non") + + "\n"; + result += + "extraction des métadonnées texte des messages: " + + (storeExtractorOptions.extractMessageTextMetadata ? "oui" : "non") + + "\n"; + result += + "génération de fichier en forme texte des pièces jointes: " + + (storeExtractorOptions.extractFileTextFile ? "oui" : "non") + + "\n"; + result += + "extraction des métadonnées texte des pièces jointes: " + + (storeExtractorOptions.extractFileTextMetadata ? "oui" : "non") + + "\n"; result += "résultat: " + storeExtractor.getSummary(); - if (start != null) - result += "en " + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java index 8bc36209..88fb8040 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/inout/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.inout; \ No newline at end of file +package fr.gouv.vitam.tools.resip.inout; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java index d39bfaa5..b1da8e11 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVImportContext.java @@ -45,7 +45,7 @@ */ public class CSVImportContext extends CreationContext { -// prefs elements + // prefs elements /** * The csv charset name. */ @@ -86,28 +86,28 @@ public CSVImportContext(Preferences preferences) { super(preferences); csvCharsetName = preferences.getPrefProperties().getProperty("importContext.csv.charsetName", ""); if (csvCharsetName.isEmpty()) { - if (System.getProperty("os.name").toLowerCase().contains("win")) - this.csvCharsetName = "windows-1252"; - else - this.csvCharsetName = "UTF-8"; + if (System.getProperty("os.name").toLowerCase().contains("win")) this.csvCharsetName = "windows-1252"; + else this.csvCharsetName = "UTF-8"; } String tmp = preferences.getPrefProperties().getProperty("importContext.csv.delimiter", ""); - if (tmp.isEmpty()) - delimiter = ';'; - else - delimiter = tmp.charAt(0); + if (tmp.isEmpty()) delimiter = ';'; + else delimiter = tmp.charAt(0); } /* (non-Javadoc) * @see CreationContext#toPrefs(Prefs) */ public void toPrefs(Preferences preferences) { - if (System.getProperty("os.name").toLowerCase().contains("win")) - preferences.getPrefProperties().setProperty("importContext.csv.charsetName", (csvCharsetName == null ? "windows-1252" : csvCharsetName)); - else - preferences.getPrefProperties().setProperty("importContext.csv.charsetName", (csvCharsetName == null ? "UTF-8" : csvCharsetName)); - preferences.getPrefProperties().setProperty("importContext.csv.delimiter", (delimiter == '\0' ? ";" : Character.toString(delimiter))); + if (System.getProperty("os.name").toLowerCase().contains("win")) preferences + .getPrefProperties() + .setProperty("importContext.csv.charsetName", (csvCharsetName == null ? "windows-1252" : csvCharsetName)); + else preferences + .getPrefProperties() + .setProperty("importContext.csv.charsetName", (csvCharsetName == null ? "UTF-8" : csvCharsetName)); + preferences + .getPrefProperties() + .setProperty("importContext.csv.delimiter", (delimiter == '\0' ? ";" : Character.toString(delimiter))); } /* (non-Javadoc) @@ -115,10 +115,8 @@ public void toPrefs(Preferences preferences) { */ public void setDefaultPrefs() { super.setDefaultPrefs(); - if (System.getProperty("os.name").toLowerCase().contains("win")) - this.csvCharsetName = "windows-1252"; - else - this.csvCharsetName = "UTF-8"; + if (System.getProperty("os.name").toLowerCase().contains("win")) this.csvCharsetName = "windows-1252"; + else this.csvCharsetName = "UTF-8"; this.delimiter = ';'; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java index 39c2bdc7..ca5a52c0 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVMetadataImportContext.java @@ -76,6 +76,5 @@ public CSVMetadataImportContext(Preferences preferences) { /* (non-Javadoc) * @see CreationContext#toPrefs(Prefs) */ - public void toPrefs(Preferences preferences) { - } + public void toPrefs(Preferences preferences) {} } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java index 291e29d0..62fc41f5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CSVTreeImportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -49,8 +49,8 @@ public class CSVTreeImportContext extends CSVImportContext { * Instantiates a new csv tree import context. */ public CSVTreeImportContext() { - this(null, ';', null, null); - } + this(null, ';', null, null); + } /** * Instantiates a new csv tree import context. @@ -61,8 +61,8 @@ public CSVTreeImportContext() { * @param workDir the work dir */ public CSVTreeImportContext(String csvCharsetName, char delimiter, String onDiskInput, String workDir) { - super(csvCharsetName, delimiter, onDiskInput, workDir); - } + super(csvCharsetName, delimiter, onDiskInput, workDir); + } /** * Instantiates a new csv tree import context from preferences. @@ -70,12 +70,11 @@ public CSVTreeImportContext(String csvCharsetName, char delimiter, String onDisk * @param preferences the prefs */ public CSVTreeImportContext(Preferences preferences) { - super(preferences); - } + super(preferences); + } - /* (non-Javadoc) - * @see CreationContext#toPrefs(Prefs) - */ - public void toPrefs(Preferences preferences) { - } + /* (non-Javadoc) + * @see CreationContext#toPrefs(Prefs) + */ + public void toPrefs(Preferences preferences) {} } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java index 90efe723..d45a5d4e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CompactContext.java @@ -105,31 +105,26 @@ public CompactContext() { * @param subDocumentKeptDataObjectVersionList the sub document kept data object version list * @param deflatedFlag the deflated flag */ - public CompactContext(String workDir, - int maxMetadataSize, - int maxDocumentNumber, - boolean metadataFilterFlag, - List keptMetadataList, - List documentKeptDataObjectVersionList, - List subDocumentKeptDataObjectVersionList, - boolean deflatedFlag + public CompactContext( + String workDir, + int maxMetadataSize, + int maxDocumentNumber, + boolean metadataFilterFlag, + List keptMetadataList, + List documentKeptDataObjectVersionList, + List subDocumentKeptDataObjectVersionList, + boolean deflatedFlag ) { super(null, workDir); this.maxMetadataSize = maxMetadataSize; this.maxDocumentNumber = maxDocumentNumber; this.metadataFilterFlag = metadataFilterFlag; - if (keptMetadataList == null) - this.keptMetadataList = new ArrayList<>(); - else - this.keptMetadataList = keptMetadataList; - if (documentKeptDataObjectVersionList == null) - this.documentKeptDataObjectVersionList = new ArrayList<>(); - else - this.documentKeptDataObjectVersionList = documentKeptDataObjectVersionList; - if (subDocumentKeptDataObjectVersionList == null) - this.subDocumentKeptDataObjectVersionList = new ArrayList<>(); - else - this.subDocumentKeptDataObjectVersionList = subDocumentKeptDataObjectVersionList; + if (keptMetadataList == null) this.keptMetadataList = new ArrayList<>(); + else this.keptMetadataList = keptMetadataList; + if (documentKeptDataObjectVersionList == null) this.documentKeptDataObjectVersionList = new ArrayList<>(); + else this.documentKeptDataObjectVersionList = documentKeptDataObjectVersionList; + if (subDocumentKeptDataObjectVersionList == null) this.subDocumentKeptDataObjectVersionList = new ArrayList<>(); + else this.subDocumentKeptDataObjectVersionList = subDocumentKeptDataObjectVersionList; this.deflatedFlag = deflatedFlag; } @@ -142,38 +137,50 @@ public CompactContext(Preferences preferences) { super(preferences); try { maxMetadataSize = Integer.parseInt( - preferences.getPrefProperties().getProperty("compactContext.general.maxMetadataSize", "0")); + preferences.getPrefProperties().getProperty("compactContext.general.maxMetadataSize", "0") + ); } catch (NumberFormatException e) { maxMetadataSize = 1000000; } try { maxDocumentNumber = Integer.parseInt( - preferences.getPrefProperties().getProperty("compactContext.general.maxDocumentNumber", "0")); + preferences.getPrefProperties().getProperty("compactContext.general.maxDocumentNumber", "0") + ); } catch (NumberFormatException e) { maxDocumentNumber = 1000; } metadataFilterFlag = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("compactContext.general.metadataFilterFlag", "false")); - String keptMetadataString = preferences.getPrefProperties().getProperty("compactContext.general.keptMetadataList", ""); - if (keptMetadataString.isEmpty()) - setDefaultPrefs(); - else - keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); - String documentKeptDataObjectVersionString = preferences.getPrefProperties().getProperty("compactContext.general.documentKeptDataObjectVersionList", ""); - if (documentKeptDataObjectVersionString.isEmpty()) - setDefaultPrefs(); - else - documentKeptDataObjectVersionList = Arrays.asList(documentKeptDataObjectVersionString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); - String subDocumentKeptDataObjectVersionString = preferences.getPrefProperties().getProperty("compactContext.general.subDocumentKeptDataObjectVersionList", ""); - if (subDocumentKeptDataObjectVersionString.isEmpty()) - setDefaultPrefs(); - else - subDocumentKeptDataObjectVersionList = Arrays.asList(subDocumentKeptDataObjectVersionString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); + preferences.getPrefProperties().getProperty("compactContext.general.metadataFilterFlag", "false") + ); + String keptMetadataString = preferences + .getPrefProperties() + .getProperty("compactContext.general.keptMetadataList", ""); + if (keptMetadataString.isEmpty()) setDefaultPrefs(); + else keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()); + String documentKeptDataObjectVersionString = preferences + .getPrefProperties() + .getProperty("compactContext.general.documentKeptDataObjectVersionList", ""); + if (documentKeptDataObjectVersionString.isEmpty()) setDefaultPrefs(); + else documentKeptDataObjectVersionList = Arrays.asList(documentKeptDataObjectVersionString.split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()); + String subDocumentKeptDataObjectVersionString = preferences + .getPrefProperties() + .getProperty("compactContext.general.subDocumentKeptDataObjectVersionList", ""); + if (subDocumentKeptDataObjectVersionString.isEmpty()) setDefaultPrefs(); + else subDocumentKeptDataObjectVersionList = Arrays.asList( + subDocumentKeptDataObjectVersionString.split("\\s*\n\\s*") + ) + .stream() + .map(String::trim) + .collect(Collectors.toList()); deflatedFlag = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("compactContext.general.deflatedFlag", "false")); + preferences.getPrefProperties().getProperty("compactContext.general.deflatedFlag", "false") + ); } /** @@ -183,13 +190,33 @@ public CompactContext(Preferences preferences) { */ @Override public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("compactContext.general.maxMetadataSize", Integer.toString(maxMetadataSize)); - preferences.getPrefProperties().setProperty("compactContext.general.maxDocumentNumber", Integer.toString(maxDocumentNumber)); - preferences.getPrefProperties().setProperty("compactContext.general.metadataFilterFlag", Boolean.toString(metadataFilterFlag)); - preferences.getPrefProperties().setProperty("compactContext.general.keptMetadataList", String.join("\n", keptMetadataList)); - preferences.getPrefProperties().setProperty("compactContext.general.documentKeptDataObjectVersionList", String.join("\n", documentKeptDataObjectVersionList)); - preferences.getPrefProperties().setProperty("compactContext.general.subDocumentKeptDataObjectVersionList", String.join("\n", subDocumentKeptDataObjectVersionList)); - preferences.getPrefProperties().setProperty("compactContext.general.deflatedFlag", Boolean.toString(deflatedFlag)); + preferences + .getPrefProperties() + .setProperty("compactContext.general.maxMetadataSize", Integer.toString(maxMetadataSize)); + preferences + .getPrefProperties() + .setProperty("compactContext.general.maxDocumentNumber", Integer.toString(maxDocumentNumber)); + preferences + .getPrefProperties() + .setProperty("compactContext.general.metadataFilterFlag", Boolean.toString(metadataFilterFlag)); + preferences + .getPrefProperties() + .setProperty("compactContext.general.keptMetadataList", String.join("\n", keptMetadataList)); + preferences + .getPrefProperties() + .setProperty( + "compactContext.general.documentKeptDataObjectVersionList", + String.join("\n", documentKeptDataObjectVersionList) + ); + preferences + .getPrefProperties() + .setProperty( + "compactContext.general.subDocumentKeptDataObjectVersionList", + String.join("\n", subDocumentKeptDataObjectVersionList) + ); + preferences + .getPrefProperties() + .setProperty("compactContext.general.deflatedFlag", Boolean.toString(deflatedFlag)); } /** @@ -201,23 +228,32 @@ public void setDefaultPrefs() { this.maxMetadataSize = 1000000; this.maxDocumentNumber = 1000; this.metadataFilterFlag = false; - String keptMetadataString = "DescriptionLevel\nTitle\n" + - "FilePlanPosition\nSystemId\nOriginatingSystemId\nOriginatingSystemIdReplyTo\n" + - "ArchivalAgencyArchiveUnitIdentifier\nOriginatingAgencyArchiveUnitIdentifier\n" + - "TransferringAgencyArchiveUnitIdentifier\n" + - "Description\nCustodialHistory\nType\nDocumentType\nLanguage\nDescriptionLanguage\n" + - "Status\nVersion\nTag\nKeyword\nCoverage\nOriginatingAgency\nSubmissionAgency\n" + - "AuthorizedAgent\nWriter\nAddressee\nRecipient\nTransmitter\nSender\nSource\nRelatedObjectReference\n" + - "CreatedDate\nTransactedDate\nAcquiredDate\nSentDate\nReceivedDate\nRegisteredDate\nStartDate\n" + - "EndDate\nEvent\nSignature\nGps\nTextContent:1000"; + String keptMetadataString = + "DescriptionLevel\nTitle\n" + + "FilePlanPosition\nSystemId\nOriginatingSystemId\nOriginatingSystemIdReplyTo\n" + + "ArchivalAgencyArchiveUnitIdentifier\nOriginatingAgencyArchiveUnitIdentifier\n" + + "TransferringAgencyArchiveUnitIdentifier\n" + + "Description\nCustodialHistory\nType\nDocumentType\nLanguage\nDescriptionLanguage\n" + + "Status\nVersion\nTag\nKeyword\nCoverage\nOriginatingAgency\nSubmissionAgency\n" + + "AuthorizedAgent\nWriter\nAddressee\nRecipient\nTransmitter\nSender\nSource\nRelatedObjectReference\n" + + "CreatedDate\nTransactedDate\nAcquiredDate\nSentDate\nReceivedDate\nRegisteredDate\nStartDate\n" + + "EndDate\nEvent\nSignature\nGps\nTextContent:1000"; this.keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); + .stream() + .map(String::trim) + .collect(Collectors.toList()); String documentKeptDataObjectVersionString = "BinaryMaster\nTextContent"; this.documentKeptDataObjectVersionList = Arrays.asList(documentKeptDataObjectVersionString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); + .stream() + .map(String::trim) + .collect(Collectors.toList()); String subDocumentKeptDataObjectVersionString = "BinaryMaster"; - this.subDocumentKeptDataObjectVersionList = Arrays.asList(subDocumentKeptDataObjectVersionString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); + this.subDocumentKeptDataObjectVersionList = Arrays.asList( + subDocumentKeptDataObjectVersionString.split("\\s*\n\\s*") + ) + .stream() + .map(String::trim) + .collect(Collectors.toList()); this.deflatedFlag = false; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java index 2d91e452..db8f9ffb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/CreationContext.java @@ -49,23 +49,27 @@ * The Class CreationContext. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") -@JsonSubTypes({ @JsonSubTypes.Type(value = DiskImportContext.class, name = "DiskImportContext"), - @JsonSubTypes.Type(value = ZipImportContext.class, name = "ZipImportContext"), - @JsonSubTypes.Type(value = CSVImportContext.class, name = "CSVImportContext"), - @JsonSubTypes.Type(value = CSVTreeImportContext.class, name = "CSVTreeImportContext"), - @JsonSubTypes.Type(value = CSVMetadataImportContext.class, name = "CSVMetadataImportContext"), - @JsonSubTypes.Type(value = SIPImportContext.class, name = "SIPImportContext"), - @JsonSubTypes.Type(value = DIPImportContext.class, name = "DIPImportContext"), - @JsonSubTypes.Type(value = MailImportContext.class, name = "MailImportContext") }) +@JsonSubTypes( + { + @JsonSubTypes.Type(value = DiskImportContext.class, name = "DiskImportContext"), + @JsonSubTypes.Type(value = ZipImportContext.class, name = "ZipImportContext"), + @JsonSubTypes.Type(value = CSVImportContext.class, name = "CSVImportContext"), + @JsonSubTypes.Type(value = CSVTreeImportContext.class, name = "CSVTreeImportContext"), + @JsonSubTypes.Type(value = CSVMetadataImportContext.class, name = "CSVMetadataImportContext"), + @JsonSubTypes.Type(value = SIPImportContext.class, name = "SIPImportContext"), + @JsonSubTypes.Type(value = DIPImportContext.class, name = "DIPImportContext"), + @JsonSubTypes.Type(value = MailImportContext.class, name = "MailImportContext"), + } +) public class CreationContext { -// prefs elements + // prefs elements /** * The work dir. */ String workDir; -// session elements + // session elements /** * The on disk input. */ @@ -85,8 +89,8 @@ public class CreationContext { * Instantiates a new creation context. */ public CreationContext() { - this(null, null); - } + this(null, null); + } /** * Instantiates a new creation context. @@ -95,11 +99,11 @@ public CreationContext() { * @param workDir the work dir */ public CreationContext(String onDiskInput, String workDir) { - this.onDiskInput = onDiskInput; - this.workDir = workDir; - this.summary = null; - this.structureChanged = false; - } + this.onDiskInput = onDiskInput; + this.workDir = workDir; + this.summary = null; + this.structureChanged = false; + } /** * Instantiates a new creation context from preferences. @@ -107,19 +111,17 @@ public CreationContext(String onDiskInput, String workDir) { * @param preferences the prefs */ public CreationContext(Preferences preferences) { - workDir = preferences.getPrefProperties().getProperty("importContext.workDir", ""); - try { - Paths.get(workDir); - } - catch (InvalidPathException e){ - workDir=""; - } - if (workDir.isEmpty()) - workDir = Preferences.getDefaultWorkDir(); - onDiskInput = null; - summary = null; - structureChanged = false; - } + workDir = preferences.getPrefProperties().getProperty("importContext.workDir", ""); + try { + Paths.get(workDir); + } catch (InvalidPathException e) { + workDir = ""; + } + if (workDir.isEmpty()) workDir = Preferences.getDefaultWorkDir(); + onDiskInput = null; + summary = null; + structureChanged = false; + } /** * Put in preferences the values specific of this context class. @@ -128,20 +130,20 @@ public CreationContext(Preferences preferences) { * @param preferences the prefs */ public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("importContext.workDir", (workDir == null ? "" : workDir)); - } + preferences.getPrefProperties().setProperty("importContext.workDir", (workDir == null ? "" : workDir)); + } /** * Sets the default prefs. */ public void setDefaultPrefs() { - workDir = Preferences.getDefaultWorkDir(); - onDiskInput = null; - summary = null; - structureChanged = false; - } + workDir = Preferences.getDefaultWorkDir(); + onDiskInput = null; + summary = null; + structureChanged = false; + } - // Getters and setters + // Getters and setters /** * Gets the work dir. @@ -149,8 +151,8 @@ public void setDefaultPrefs() { * @return the work dir */ public String getWorkDir() { - return workDir; - } + return workDir; + } /** * Sets the work dir. @@ -158,8 +160,8 @@ public String getWorkDir() { * @param workDir the new work dir */ public void setWorkDir(String workDir) { - this.workDir = workDir; - } + this.workDir = workDir; + } /** * Gets the on disk input. @@ -167,8 +169,8 @@ public void setWorkDir(String workDir) { * @return the on disk input */ public String getOnDiskInput() { - return onDiskInput; - } + return onDiskInput; + } /** * Sets the on disk input. @@ -176,8 +178,8 @@ public String getOnDiskInput() { * @param onDiskInput the new on disk input */ public void setOnDiskInput(String onDiskInput) { - this.onDiskInput = onDiskInput; - } + this.onDiskInput = onDiskInput; + } /** * Gets the actualised summary. @@ -186,15 +188,13 @@ public void setOnDiskInput(String onDiskInput) { * @return the actualised summary */ @JsonIgnore - public String getActualisedSummary(DataObjectPackage at) { - if (structureChanged) { - String result=(summary==null?"":summary+"\n") + "Structure modifiée\n"; - result += at.getDescription(); - return result; - } - else - return summary + "\nPas de modification"; - } + public String getActualisedSummary(DataObjectPackage at) { + if (structureChanged) { + String result = (summary == null ? "" : summary + "\n") + "Structure modifiée\n"; + result += at.getDescription(); + return result; + } else return summary + "\nPas de modification"; + } /** * Gets the summary. @@ -202,8 +202,8 @@ public String getActualisedSummary(DataObjectPackage at) { * @return the summary */ public String getSummary() { - return summary; - } + return summary; + } /** * Sets the summary. @@ -211,8 +211,8 @@ public String getSummary() { * @param summary the new summary */ public void setSummary(String summary) { - this.summary = summary; - } + this.summary = summary; + } /** * Checks if is structure changed. @@ -220,8 +220,8 @@ public void setSummary(String summary) { * @return true, if is structure changed */ public boolean isStructureChanged() { - return structureChanged; - } + return structureChanged; + } /** * Sets the structure changed. @@ -229,7 +229,6 @@ public boolean isStructureChanged() { * @param structureChanged the new structure changed */ public void setStructureChanged(boolean structureChanged) { - this.structureChanged = structureChanged; - } - -} \ No newline at end of file + this.structureChanged = structureChanged; + } +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java index 4a5dda6a..0eacf516 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DIPImportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -49,8 +49,8 @@ public class DIPImportContext extends CreationContext { * Instantiates a new DIP import context. */ public DIPImportContext() { - this(null, null); - } + this(null, null); + } /** * Instantiates a new DIP import context. @@ -59,8 +59,8 @@ public DIPImportContext() { * @param workDir the work dir */ public DIPImportContext(String onDiskInput, String workDir) { - super (onDiskInput, workDir); - } + super(onDiskInput, workDir); + } /** * Instantiates a new DIP import context. @@ -68,12 +68,11 @@ public DIPImportContext(String onDiskInput, String workDir) { * @param preferences the prefs */ public DIPImportContext(Preferences preferences) { - super(preferences); - } + super(preferences); + } - /* (non-Javadoc) - * @see CreationContext#toPrefs(Prefs) - */ - public void toPrefs(Preferences preferences) { - } + /* (non-Javadoc) + * @see CreationContext#toPrefs(Prefs) + */ + public void toPrefs(Preferences preferences) {} } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java index 660f25bc..a4f9ff08 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/DiskImportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -49,7 +49,7 @@ */ public class DiskImportContext extends CreationContext { -// prefs elements + // prefs elements /** * The ignore pattern list. */ @@ -60,7 +60,7 @@ public class DiskImportContext extends CreationContext { */ boolean noLinkFlag; -// session element + // session element /** * The model version. */ @@ -70,8 +70,8 @@ public class DiskImportContext extends CreationContext { * Instantiates a new disk import context. */ public DiskImportContext() { - this(null, false, null, null); - } + this(null, false, null, null); + } /** * Instantiates a new disk import context. @@ -82,48 +82,49 @@ public DiskImportContext() { * @param workDir the work dir */ public DiskImportContext(List ignorePatternList, boolean noLinkFlag, String onDiskInput, String workDir) { - super(onDiskInput, workDir); - if (ignorePatternList == null) - this.ignorePatternList = new ArrayList(); - else - this.ignorePatternList = ignorePatternList; - this.noLinkFlag=noLinkFlag; - } - - /** - * Instantiates a new disk import context. - * - * @param preferences the prefs - */ - public DiskImportContext(Preferences preferences) { - super(preferences); - String ignorePatternsString = preferences.getPrefProperties().getProperty("importContext.disk.ignorePatternList", ""); - if (ignorePatternsString.isEmpty()) - ignorePatternList = new ArrayList(); - else - ignorePatternList = Arrays.asList(ignorePatternsString.split("\\s*\n\\s*")); - noLinkFlag=Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("importContext.disk.noLinkFlag", "false")); - } - - /* (non-Javadoc) - * @see CreationContext#toPrefs(Prefs) - */ - public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("importContext.disk.ignorePatternList", String.join("\n", ignorePatternList)); - preferences.getPrefProperties().setProperty("importContext.disk.noLinkFlag",Boolean.toString(noLinkFlag)); - } - - /* (non-Javadoc) - * @see CreationContext#setDefaultPrefs() - */ - public void setDefaultPrefs() { - super.setDefaultPrefs(); - ignorePatternList = Arrays.asList("Thumbs.db", "pagefile.sys"); - noLinkFlag=false; - } - - // Getters and setters + super(onDiskInput, workDir); + if (ignorePatternList == null) this.ignorePatternList = new ArrayList(); + else this.ignorePatternList = ignorePatternList; + this.noLinkFlag = noLinkFlag; + } + + /** + * Instantiates a new disk import context. + * + * @param preferences the prefs + */ + public DiskImportContext(Preferences preferences) { + super(preferences); + String ignorePatternsString = preferences + .getPrefProperties() + .getProperty("importContext.disk.ignorePatternList", ""); + if (ignorePatternsString.isEmpty()) ignorePatternList = new ArrayList(); + else ignorePatternList = Arrays.asList(ignorePatternsString.split("\\s*\n\\s*")); + noLinkFlag = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("importContext.disk.noLinkFlag", "false") + ); + } + + /* (non-Javadoc) + * @see CreationContext#toPrefs(Prefs) + */ + public void toPrefs(Preferences preferences) { + preferences + .getPrefProperties() + .setProperty("importContext.disk.ignorePatternList", String.join("\n", ignorePatternList)); + preferences.getPrefProperties().setProperty("importContext.disk.noLinkFlag", Boolean.toString(noLinkFlag)); + } + + /* (non-Javadoc) + * @see CreationContext#setDefaultPrefs() + */ + public void setDefaultPrefs() { + super.setDefaultPrefs(); + ignorePatternList = Arrays.asList("Thumbs.db", "pagefile.sys"); + noLinkFlag = false; + } + + // Getters and setters /** * Gets the ignore pattern list. @@ -131,8 +132,8 @@ public void setDefaultPrefs() { * @return the ignore pattern list */ public List getIgnorePatternList() { - return ignorePatternList; - } + return ignorePatternList; + } /** * Sets the ignore pattern list. @@ -140,8 +141,8 @@ public List getIgnorePatternList() { * @param ignorePatternList the new ignore pattern list */ public void setIgnorePatternList(List ignorePatternList) { - this.ignorePatternList = ignorePatternList; - } + this.ignorePatternList = ignorePatternList; + } /** * Is no link flag boolean. @@ -149,8 +150,8 @@ public void setIgnorePatternList(List ignorePatternList) { * @return the boolean */ public boolean isNoLinkFlag() { - return noLinkFlag; - } + return noLinkFlag; + } /** * Sets no link flag. @@ -158,8 +159,8 @@ public boolean isNoLinkFlag() { * @param noLinkFlag the no link flag */ public void setNoLinkFlag(boolean noLinkFlag) { - this.noLinkFlag = noLinkFlag; - } + this.noLinkFlag = noLinkFlag; + } /** * Gets the model version. @@ -167,8 +168,8 @@ public void setNoLinkFlag(boolean noLinkFlag) { * @return the model version */ public int getModelVersion() { - return modelVersion; - } + return modelVersion; + } /** * Sets the model version. @@ -176,6 +177,6 @@ public int getModelVersion() { * @param modelVersion the new model version */ public void setModelVersion(int modelVersion) { - this.modelVersion = modelVersion; - } + this.modelVersion = modelVersion; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java index 694188db..7a1998f3 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ExportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -59,501 +59,617 @@ /** * The Class ExportContext. */ -@JsonIgnoreProperties({"serializationVersion"}) +@JsonIgnoreProperties({ "serializationVersion" }) public class ExportContext { - // prefs elements - /** The hierarchical archive units in SEDA manifest. */ - private boolean hierarchicalArchiveUnits; - - /** The indented xml in SEDA manifest. */ - private boolean indented; - - /** The DataObjectPackage elements reindex before export flag. */ - private boolean reindex; - - /** The csv export mode for usage_version object selection. */ - private int usageVersionSelectionMode; - - /** The csv export max name size for directories. */ - private int maxNameSize; - - /** The csv extended format flag. */ - private boolean csvExtendedFormat; - - /** The ManagementMetadata. */ - private String managementMetadataXmlData; - - /** The archive transfer global metadata. */ - private GlobalMetadata globalMetadata; - - /** The descriptive metadata filter flag. */ - private boolean metadataFilterFlag; - - /** The descriptive metadata kept in content. */ - private List keptMetadataList; - - /** The on disk output. */ - private String onDiskOutput; - - /** - * Instantiates a new global metadata context. - */ - public ExportContext() { - this.hierarchicalArchiveUnits = true; - this.indented = true; - this.reindex = false; - this.usageVersionSelectionMode = LAST_DATAOBJECT; - this.maxNameSize = 32; - this.csvExtendedFormat = true; - this.globalMetadata = new GlobalMetadata(); - this.managementMetadataXmlData = null; - this.onDiskOutput = null; - this.metadataFilterFlag = false; - this.keptMetadataList = new ArrayList<>(); - } - - /** - * Instantiates a new global metadata context. - * - * @param globalMetadata the archive transfer global metadata - * @param hierarchicalArchiveUnits the hierarchical archive units - * @param indented the indented - * @param reindex the reindex - * @param usageVersionSelectionMode the usage version selection mode - * @param maxNameSize the max name size - * @param onDiskOutput the on disk output - * @param managementMetadataXmlData the management metadata xml data - * @param metadataFilterFlag the metadata filter flag - * @param keptMetadataList the kept metadata list - */ - public ExportContext(GlobalMetadata globalMetadata, - boolean hierarchicalArchiveUnits, boolean indented, boolean reindex, int usageVersionSelectionMode, - int maxNameSize, boolean csvExtendedFormat, String onDiskOutput, String managementMetadataXmlData, - boolean metadataFilterFlag, List keptMetadataList) { - this.hierarchicalArchiveUnits = hierarchicalArchiveUnits; - this.indented = indented; - this.reindex = indented; - this.usageVersionSelectionMode = usageVersionSelectionMode; - this.maxNameSize = maxNameSize; - this.csvExtendedFormat=csvExtendedFormat; - this.globalMetadata=globalMetadata; - this.managementMetadataXmlData=managementMetadataXmlData; - this.setOnDiskOutput(onDiskOutput); - this.metadataFilterFlag=metadataFilterFlag; - if (keptMetadataList == null) - this.keptMetadataList = new ArrayList<>(); - else - this.keptMetadataList = keptMetadataList; - } - - /** - * Instantiates a new ExportContext from a file. - * - * @param sipExportFileName the sipExportFileName - * @throws ResipException the ResipException - */ - public ExportContext(String sipExportFileName) throws ResipException { - ObjectMapper mapper = new ObjectMapper(); - - try (FileInputStream fis = new FileInputStream(new File(sipExportFileName))) { - JsonParser jsonParser = mapper.getFactory().createParser(fis); - jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); - ExportContext sec=mapper.readValue(jsonParser, ExportContext.class); - this.hierarchicalArchiveUnits = sec.hierarchicalArchiveUnits; - this.indented = sec.indented; - this.reindex = sec.reindex; - this.usageVersionSelectionMode = sec.usageVersionSelectionMode; - this.maxNameSize = sec.maxNameSize; - this.csvExtendedFormat= sec.csvExtendedFormat; - this.globalMetadata=sec.globalMetadata; - this.managementMetadataXmlData=sec.managementMetadataXmlData; - this.metadataFilterFlag=sec.metadataFilterFlag; - this.keptMetadataList=sec.keptMetadataList; - } catch (IOException e) { - throw new ResipException("Resip.InOut: Le fichier [" + sipExportFileName - + "] de contexte est illisible", e); - } - } - - /** - * Null if empty. - * - * @param s the s - * @return the string - */ - private static String nullIfEmpty(String s) { - if (s.isEmpty()) - return null; - return s; - } - - /** - * Instantiates a new GlobalMetadata from the preferences. - * - * @param preferences the prefs - */ - public ExportContext(Preferences preferences) { - setArchiveTransferGlobalMetadata(new GlobalMetadata()); - hierarchicalArchiveUnits = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.general.hierarchicalArchiveUnits", "true")); - indented = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.general.indented", "true")); - reindex = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.general.reindex", "false")); - try { - usageVersionSelectionMode=Integer.parseInt( - preferences.getPrefProperties().getProperty("exportContext.csvExport.usageVersionSelectionMode",Integer.toString(LAST_DATAOBJECT))); - } - catch (NumberFormatException e){ - usageVersionSelectionMode=LAST_DATAOBJECT; - } - if ((usageVersionSelectionModeALL_DATAOBJECTS)) usageVersionSelectionMode=LAST_DATAOBJECT; - try { - maxNameSize=Integer.parseInt( - preferences.getPrefProperties().getProperty("exportContext.csvExport.maxNameSize","32")); - } - catch (NumberFormatException e){ - maxNameSize=32; - } - if (maxNameSize<0) maxNameSize=0; - csvExtendedFormat = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.csvExport.csvExtendedFormat", "true")); - managementMetadataXmlData=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.general.managementMetadataXmlData", "")); - metadataFilterFlag = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.general.metadataFilterFlag", "false")); - String keptMetadataString = preferences.getPrefProperties().getProperty("exportContext.general.keptMetadataList", ""); - if (keptMetadataString.isEmpty()) - keptMetadataList = new ArrayList<>(); - else - keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); - - getArchiveTransferGlobalMetadata().comment=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.comment", "")); - getArchiveTransferGlobalMetadata().date=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.date", "")); - getArchiveTransferGlobalMetadata().setNowFlag(Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.nowFlag", "true"))); - getArchiveTransferGlobalMetadata().messageIdentifier=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.messageIdentifier", "")); - getArchiveTransferGlobalMetadata().archivalAgreement=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.archivalAgreement", "")); - getArchiveTransferGlobalMetadata() - .codeListVersionsXmlData=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.codeListVersionsXmlData", "")); - getArchiveTransferGlobalMetadata() - .transferRequestReplyIdentifier=nullIfEmpty(preferences.getPrefProperties().getProperty("exportContext.globalMetadata.transferRequestReplyIdentifier", "")); - getArchiveTransferGlobalMetadata() - .archivalAgencyIdentifier=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.archivalAgencyIdentifier", "")); - getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData= - nullIfEmpty(preferences.getPrefProperties().getProperty("exportContext.globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData", "")); - getArchiveTransferGlobalMetadata() - .transferringAgencyIdentifier=nullIfEmpty( - preferences.getPrefProperties().getProperty("exportContext.globalMetadata.transferringAgencyIdentifier", "")); - getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData= - nullIfEmpty(preferences.getPrefProperties().getProperty("exportContext.globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData", "")); - } - - /** - * To prefs. - * - * @param preferences the prefs - */ - public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("exportContext.general.hierarchicalArchiveUnits", Boolean.toString(hierarchicalArchiveUnits)); - preferences.getPrefProperties().setProperty("exportContext.general.indented", Boolean.toString(indented)); - preferences.getPrefProperties().setProperty("exportContext.general.reindex", Boolean.toString(reindex)); - preferences.getPrefProperties().setProperty("exportContext.csvExport.usageVersionSelectionMode", Integer.toString(usageVersionSelectionMode)); - preferences.getPrefProperties().setProperty("exportContext.csvExport.maxNameSize", Integer.toString(maxNameSize)); - preferences.getPrefProperties().setProperty("exportContext.csvExport.csvExtendedFormat", Boolean.toString(csvExtendedFormat)); - preferences.getPrefProperties().setProperty("exportContext.general.managementMetadataXmlData", (managementMetadataXmlData == null ? "" - : managementMetadataXmlData)); - preferences.getPrefProperties().setProperty("exportContext.general.metadataFilterFlag", Boolean.toString(metadataFilterFlag)); - preferences.getPrefProperties().setProperty("exportContext.general.keptMetadataList", String.join("\n", keptMetadataList)); - - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.comment", (getArchiveTransferGlobalMetadata().comment == null ? "" - : getArchiveTransferGlobalMetadata().comment)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.date", (getArchiveTransferGlobalMetadata().date == null ? "" - : getArchiveTransferGlobalMetadata().date)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.nowFlag", Boolean.toString(getArchiveTransferGlobalMetadata().isNowFlag())); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.messageIdentifier", (getArchiveTransferGlobalMetadata().messageIdentifier == null ? "" - : getArchiveTransferGlobalMetadata().messageIdentifier)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.archivalAgreement", (getArchiveTransferGlobalMetadata().archivalAgreement == null ? "" - : getArchiveTransferGlobalMetadata().archivalAgreement)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.codeListVersionsXmlData", - (getArchiveTransferGlobalMetadata().codeListVersionsXmlData == null ? "" - : getArchiveTransferGlobalMetadata().codeListVersionsXmlData)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.transferRequestReplyIdentifier", - (getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier == null ? "" - : getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.archivalAgencyIdentifier", - (getArchiveTransferGlobalMetadata().archivalAgencyIdentifier == null ? "" - : getArchiveTransferGlobalMetadata().archivalAgencyIdentifier)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData", - (getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData == null ? "" - : getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.transferringAgencyIdentifier", - (getArchiveTransferGlobalMetadata().transferringAgencyIdentifier == null ? "" - : getArchiveTransferGlobalMetadata().transferringAgencyIdentifier)); - preferences.getPrefProperties().setProperty("exportContext.globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData", - (getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData == null ? "" - : getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData)); - } - - /** - * Sets the default prefs. - */ - public void setDefaultPrefs() { - this.hierarchicalArchiveUnits = true; - this.indented = true; - this.reindex = false; - this.usageVersionSelectionMode = LAST_DATAOBJECT; - this.maxNameSize = 32; - this.csvExtendedFormat = true; - this.managementMetadataXmlData=" \n" - + " Acquisition Information\n" - + " Public Archive\n" - + " Service_producteur\n" - + " Service_versant\n" - + " "; - this.metadataFilterFlag=false; - String keptMetadataString="DescriptionLevel\nTitle\n" + - "FilePlanPosition\nSystemId\nOriginatingSystemId\n" + - "ArchivalAgencyArchiveUnitIdentifier\nOriginatingAgencyArchiveUnitIdentifier\n"+ - "TransferringAgencyArchiveUnitIdentifier\n"+ - "Description\nCustodialHistory\nType\nDocumentType\nLanguage\nDescriptionLanguage\n"+ - "Status\nVersion\nTag\nKeyword\nCoverage\nOriginatingAgency\nSubmissionAgency\n"+ - "AuthorizedAgent\nWriter\nAddressee\nRecipient\nTransmitter\nSender\nSource\nRelatedObjectReference\n"+ - "CreatedDate\nTransactedDate\nAcquiredDate\nSentDate\nReceivedDate\nRegisteredDate\nStartDate\n"+ - "EndDate\nEvent\nSignature\nGps"; - this.keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) - .stream().map(String::trim).collect(Collectors.toList()); - if (getArchiveTransferGlobalMetadata() == null) - setArchiveTransferGlobalMetadata(new GlobalMetadata()); - getArchiveTransferGlobalMetadata().comment="Avec valeurs utilisables sur environnement de démo Vitam"; - getArchiveTransferGlobalMetadata().setNowFlag(true); - getArchiveTransferGlobalMetadata().messageIdentifier="SIP SEDA de test"; - getArchiveTransferGlobalMetadata().archivalAgreement="ArchivalAgreement0"; - getArchiveTransferGlobalMetadata().codeListVersionsXmlData=" \n" - + " ReplyCodeListVersion0\n" - + " MessageDigestAlgorithmCodeListVersion0\n" - + " MimeTypeCodeListVersion0\n" - + " EncodingCodeListVersion0\n" - + " FileFormatCodeListVersion0\n" - + " CompressionAlgorithmCodeListVersion0\n" - + " DataObjectVersionCodeListVersion0\n" - + " StorageRuleCodeListVersion0\n" - + " AppraisalRuleCodeListVersion0\n" - + " AccessRuleCodeListVersion0\n" - + " DisseminationRuleCodeListVersion0\n" - + " ReuseRuleCodeListVersion0\n" - + " ClassificationRuleCodeListVersion0\n" - + " AuthorizationReasonCodeListVersion0\n" - + " RelationshipCodeListVersion0\n" - + " "; - getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier="Identifier3"; - getArchiveTransferGlobalMetadata().archivalAgencyIdentifier="Identifier4"; - getArchiveTransferGlobalMetadata().transferringAgencyIdentifier="Identifier5"; - } - - /** - * Gets the archive transfer global metadata. - * - * @return the archive transfer global metadata - */ - public GlobalMetadata getArchiveTransferGlobalMetadata() { - return globalMetadata; - } - - /** - * Sets the archive transfer global metadata. - * - * @param globalMetadata the new archive transfer global metadata - */ - public void setArchiveTransferGlobalMetadata(GlobalMetadata globalMetadata) { - this.globalMetadata = globalMetadata; - } - - /** - * Checks if is hierarchical archive units. - * - * @return true, if is hierarchical archive units - */ - public boolean isHierarchicalArchiveUnits() { - return hierarchicalArchiveUnits; - } - - /** - * Sets the hierarchical archive units. - * - * @param hierarchicalArchiveUnits the new hierarchical archive units - */ - public void setHierarchicalArchiveUnits(boolean hierarchicalArchiveUnits) { - this.hierarchicalArchiveUnits = hierarchicalArchiveUnits; - } - - /** - * Checks if is indented. - * - * @return true, if is indented - */ - public boolean isIndented() { - return indented; - } - - /** - * Sets the indented. - * - * @param indented the new indented - */ - public void setIndented(boolean indented) { - this.indented = indented; - } - - /** - * Is reindex boolean. - * - * @return the boolean - */ - public boolean isReindex() { - return reindex; - } - - /** - * Sets reindex. - * - * @param reindex the reindex - */ - public void setReindex(boolean reindex) { - this.reindex = reindex; - } - - /** - * Gets usage version selection mode. - * - * @return the usage version selection mode - */ - public int getUsageVersionSelectionMode() { - return usageVersionSelectionMode; - } - - /** - * Sets usage version selection mode. - * - * @param usageVersionSelectionMode the usage version selection mode - */ - public void setUsageVersionSelectionMode(int usageVersionSelectionMode) { - this.usageVersionSelectionMode = usageVersionSelectionMode; - } - - /** - * Gets max name size. - * - * @return the max name size - */ - public int getMaxNameSize() { - return maxNameSize; - } - - /** - * Sets max name size. - * - * @param maxNameSize the max name size - */ - public void setMaxNameSize(int maxNameSize) { - this.maxNameSize = maxNameSize; - } - - /** - * Is csv extended format boolean. - * - * @return the boolean - */ - public boolean isCsvExtendedFormat() { - return csvExtendedFormat; - } - - /** - * Sets csv extended format. - * - * @param csvExtendedFormat the csv extended format - */ - public void setCsvExtendedFormat(boolean csvExtendedFormat) { - this.csvExtendedFormat = csvExtendedFormat; - } - - /** - * Gets the management metadata xml data. - * - * @return the management metadata xml data - */ - public String getManagementMetadataXmlData() { - return managementMetadataXmlData; - } - - /** - * Sets the management metadata xml data. - * - * @param managementMetadataXmlData the new management metadata xml data - */ - public void setManagementMetadataXmlData(String managementMetadataXmlData) { - this.managementMetadataXmlData = managementMetadataXmlData; - } - - /** - * Gets on disk output. - * - * @return the on disk output - */ - public String getOnDiskOutput() { - return onDiskOutput; - } - - /** - * Sets on disk output. - * - * @param onDiskOutput the on disk output - */ - public void setOnDiskOutput(String onDiskOutput) { - this.onDiskOutput = onDiskOutput; - } - - /** - * Is metadata filter flag boolean. - * - * @return the boolean - */ - public boolean isMetadataFilterFlag() { - return metadataFilterFlag; - } - - /** - * Sets metadata filter flag. - * - * @param metadataFilterFlag the metadata filter flag - */ - public void setMetadataFilterFlag(boolean metadataFilterFlag) { - this.metadataFilterFlag = metadataFilterFlag; - } - - /** - * Gets kept metadata list. - * - * @return the kept metadata list - */ - public List getKeptMetadataList() { - return keptMetadataList; - } - - /** - * Sets kept metadata list. - * - * @param keptMetadataList the kept metadata list - */ - public void setKeptMetadataList(List keptMetadataList) { - this.keptMetadataList = keptMetadataList; - } + // prefs elements + /** The hierarchical archive units in SEDA manifest. */ + private boolean hierarchicalArchiveUnits; + + /** The indented xml in SEDA manifest. */ + private boolean indented; + + /** The DataObjectPackage elements reindex before export flag. */ + private boolean reindex; + + /** The csv export mode for usage_version object selection. */ + private int usageVersionSelectionMode; + + /** The csv export max name size for directories. */ + private int maxNameSize; + + /** The csv extended format flag. */ + private boolean csvExtendedFormat; + + /** The ManagementMetadata. */ + private String managementMetadataXmlData; + + /** The archive transfer global metadata. */ + private GlobalMetadata globalMetadata; + + /** The descriptive metadata filter flag. */ + private boolean metadataFilterFlag; + + /** The descriptive metadata kept in content. */ + private List keptMetadataList; + + /** The on disk output. */ + private String onDiskOutput; + + /** + * Instantiates a new global metadata context. + */ + public ExportContext() { + this.hierarchicalArchiveUnits = true; + this.indented = true; + this.reindex = false; + this.usageVersionSelectionMode = LAST_DATAOBJECT; + this.maxNameSize = 32; + this.csvExtendedFormat = true; + this.globalMetadata = new GlobalMetadata(); + this.managementMetadataXmlData = null; + this.onDiskOutput = null; + this.metadataFilterFlag = false; + this.keptMetadataList = new ArrayList<>(); + } + + /** + * Instantiates a new global metadata context. + * + * @param globalMetadata the archive transfer global metadata + * @param hierarchicalArchiveUnits the hierarchical archive units + * @param indented the indented + * @param reindex the reindex + * @param usageVersionSelectionMode the usage version selection mode + * @param maxNameSize the max name size + * @param onDiskOutput the on disk output + * @param managementMetadataXmlData the management metadata xml data + * @param metadataFilterFlag the metadata filter flag + * @param keptMetadataList the kept metadata list + */ + public ExportContext( + GlobalMetadata globalMetadata, + boolean hierarchicalArchiveUnits, + boolean indented, + boolean reindex, + int usageVersionSelectionMode, + int maxNameSize, + boolean csvExtendedFormat, + String onDiskOutput, + String managementMetadataXmlData, + boolean metadataFilterFlag, + List keptMetadataList + ) { + this.hierarchicalArchiveUnits = hierarchicalArchiveUnits; + this.indented = indented; + this.reindex = indented; + this.usageVersionSelectionMode = usageVersionSelectionMode; + this.maxNameSize = maxNameSize; + this.csvExtendedFormat = csvExtendedFormat; + this.globalMetadata = globalMetadata; + this.managementMetadataXmlData = managementMetadataXmlData; + this.setOnDiskOutput(onDiskOutput); + this.metadataFilterFlag = metadataFilterFlag; + if (keptMetadataList == null) this.keptMetadataList = new ArrayList<>(); + else this.keptMetadataList = keptMetadataList; + } + + /** + * Instantiates a new ExportContext from a file. + * + * @param sipExportFileName the sipExportFileName + * @throws ResipException the ResipException + */ + public ExportContext(String sipExportFileName) throws ResipException { + ObjectMapper mapper = new ObjectMapper(); + + try (FileInputStream fis = new FileInputStream(new File(sipExportFileName))) { + JsonParser jsonParser = mapper.getFactory().createParser(fis); + jsonParser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); + ExportContext sec = mapper.readValue(jsonParser, ExportContext.class); + this.hierarchicalArchiveUnits = sec.hierarchicalArchiveUnits; + this.indented = sec.indented; + this.reindex = sec.reindex; + this.usageVersionSelectionMode = sec.usageVersionSelectionMode; + this.maxNameSize = sec.maxNameSize; + this.csvExtendedFormat = sec.csvExtendedFormat; + this.globalMetadata = sec.globalMetadata; + this.managementMetadataXmlData = sec.managementMetadataXmlData; + this.metadataFilterFlag = sec.metadataFilterFlag; + this.keptMetadataList = sec.keptMetadataList; + } catch (IOException e) { + throw new ResipException( + "Resip.InOut: Le fichier [" + sipExportFileName + "] de contexte est illisible", + e + ); + } + } + + /** + * Null if empty. + * + * @param s the s + * @return the string + */ + private static String nullIfEmpty(String s) { + if (s.isEmpty()) return null; + return s; + } + + /** + * Instantiates a new GlobalMetadata from the preferences. + * + * @param preferences the prefs + */ + public ExportContext(Preferences preferences) { + setArchiveTransferGlobalMetadata(new GlobalMetadata()); + hierarchicalArchiveUnits = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.general.hierarchicalArchiveUnits", "true") + ); + indented = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.general.indented", "true") + ); + reindex = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.general.reindex", "false") + ); + try { + usageVersionSelectionMode = Integer.parseInt( + preferences + .getPrefProperties() + .getProperty("exportContext.csvExport.usageVersionSelectionMode", Integer.toString(LAST_DATAOBJECT)) + ); + } catch (NumberFormatException e) { + usageVersionSelectionMode = LAST_DATAOBJECT; + } + if ( + (usageVersionSelectionMode < FIRST_DATAOBJECT) || (usageVersionSelectionMode > ALL_DATAOBJECTS) + ) usageVersionSelectionMode = LAST_DATAOBJECT; + try { + maxNameSize = Integer.parseInt( + preferences.getPrefProperties().getProperty("exportContext.csvExport.maxNameSize", "32") + ); + } catch (NumberFormatException e) { + maxNameSize = 32; + } + if (maxNameSize < 0) maxNameSize = 0; + csvExtendedFormat = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.csvExport.csvExtendedFormat", "true") + ); + managementMetadataXmlData = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.general.managementMetadataXmlData", "") + ); + metadataFilterFlag = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.general.metadataFilterFlag", "false") + ); + String keptMetadataString = preferences + .getPrefProperties() + .getProperty("exportContext.general.keptMetadataList", ""); + if (keptMetadataString.isEmpty()) keptMetadataList = new ArrayList<>(); + else keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()); + + getArchiveTransferGlobalMetadata().comment = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.comment", "") + ); + getArchiveTransferGlobalMetadata().date = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.date", "") + ); + getArchiveTransferGlobalMetadata() + .setNowFlag( + Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.nowFlag", "true") + ) + ); + getArchiveTransferGlobalMetadata().messageIdentifier = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.messageIdentifier", "") + ); + getArchiveTransferGlobalMetadata().archivalAgreement = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.archivalAgreement", "") + ); + getArchiveTransferGlobalMetadata().codeListVersionsXmlData = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.codeListVersionsXmlData", "") + ); + getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier = nullIfEmpty( + preferences + .getPrefProperties() + .getProperty("exportContext.globalMetadata.transferRequestReplyIdentifier", "") + ); + getArchiveTransferGlobalMetadata().archivalAgencyIdentifier = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.archivalAgencyIdentifier", "") + ); + getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData = nullIfEmpty( + preferences + .getPrefProperties() + .getProperty("exportContext.globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData", "") + ); + getArchiveTransferGlobalMetadata().transferringAgencyIdentifier = nullIfEmpty( + preferences.getPrefProperties().getProperty("exportContext.globalMetadata.transferringAgencyIdentifier", "") + ); + getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData = nullIfEmpty( + preferences + .getPrefProperties() + .getProperty( + "exportContext.globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData", + "" + ) + ); + } + + /** + * To prefs. + * + * @param preferences the prefs + */ + public void toPrefs(Preferences preferences) { + preferences + .getPrefProperties() + .setProperty("exportContext.general.hierarchicalArchiveUnits", Boolean.toString(hierarchicalArchiveUnits)); + preferences.getPrefProperties().setProperty("exportContext.general.indented", Boolean.toString(indented)); + preferences.getPrefProperties().setProperty("exportContext.general.reindex", Boolean.toString(reindex)); + preferences + .getPrefProperties() + .setProperty( + "exportContext.csvExport.usageVersionSelectionMode", + Integer.toString(usageVersionSelectionMode) + ); + preferences + .getPrefProperties() + .setProperty("exportContext.csvExport.maxNameSize", Integer.toString(maxNameSize)); + preferences + .getPrefProperties() + .setProperty("exportContext.csvExport.csvExtendedFormat", Boolean.toString(csvExtendedFormat)); + preferences + .getPrefProperties() + .setProperty( + "exportContext.general.managementMetadataXmlData", + (managementMetadataXmlData == null ? "" : managementMetadataXmlData) + ); + preferences + .getPrefProperties() + .setProperty("exportContext.general.metadataFilterFlag", Boolean.toString(metadataFilterFlag)); + preferences + .getPrefProperties() + .setProperty("exportContext.general.keptMetadataList", String.join("\n", keptMetadataList)); + + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.comment", + (getArchiveTransferGlobalMetadata().comment == null ? "" : getArchiveTransferGlobalMetadata().comment) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.date", + (getArchiveTransferGlobalMetadata().date == null ? "" : getArchiveTransferGlobalMetadata().date) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.nowFlag", + Boolean.toString(getArchiveTransferGlobalMetadata().isNowFlag()) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.messageIdentifier", + (getArchiveTransferGlobalMetadata().messageIdentifier == null + ? "" + : getArchiveTransferGlobalMetadata().messageIdentifier) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.archivalAgreement", + (getArchiveTransferGlobalMetadata().archivalAgreement == null + ? "" + : getArchiveTransferGlobalMetadata().archivalAgreement) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.codeListVersionsXmlData", + (getArchiveTransferGlobalMetadata().codeListVersionsXmlData == null + ? "" + : getArchiveTransferGlobalMetadata().codeListVersionsXmlData) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.transferRequestReplyIdentifier", + (getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier == null + ? "" + : getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.archivalAgencyIdentifier", + (getArchiveTransferGlobalMetadata().archivalAgencyIdentifier == null + ? "" + : getArchiveTransferGlobalMetadata().archivalAgencyIdentifier) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData", + (getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData == null + ? "" + : getArchiveTransferGlobalMetadata().archivalAgencyOrganizationDescriptiveMetadataXmlData) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.transferringAgencyIdentifier", + (getArchiveTransferGlobalMetadata().transferringAgencyIdentifier == null + ? "" + : getArchiveTransferGlobalMetadata().transferringAgencyIdentifier) + ); + preferences + .getPrefProperties() + .setProperty( + "exportContext.globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData", + (getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData == null + ? "" + : getArchiveTransferGlobalMetadata().transferringAgencyOrganizationDescriptiveMetadataXmlData) + ); + } + + /** + * Sets the default prefs. + */ + public void setDefaultPrefs() { + this.hierarchicalArchiveUnits = true; + this.indented = true; + this.reindex = false; + this.usageVersionSelectionMode = LAST_DATAOBJECT; + this.maxNameSize = 32; + this.csvExtendedFormat = true; + this.managementMetadataXmlData = " \n" + + " Acquisition Information\n" + + " Public Archive\n" + + " Service_producteur\n" + + " Service_versant\n" + + " "; + this.metadataFilterFlag = false; + String keptMetadataString = + "DescriptionLevel\nTitle\n" + + "FilePlanPosition\nSystemId\nOriginatingSystemId\n" + + "ArchivalAgencyArchiveUnitIdentifier\nOriginatingAgencyArchiveUnitIdentifier\n" + + "TransferringAgencyArchiveUnitIdentifier\n" + + "Description\nCustodialHistory\nType\nDocumentType\nLanguage\nDescriptionLanguage\n" + + "Status\nVersion\nTag\nKeyword\nCoverage\nOriginatingAgency\nSubmissionAgency\n" + + "AuthorizedAgent\nWriter\nAddressee\nRecipient\nTransmitter\nSender\nSource\nRelatedObjectReference\n" + + "CreatedDate\nTransactedDate\nAcquiredDate\nSentDate\nReceivedDate\nRegisteredDate\nStartDate\n" + + "EndDate\nEvent\nSignature\nGps"; + this.keptMetadataList = Arrays.asList(keptMetadataString.split("\\s*\n\\s*")) + .stream() + .map(String::trim) + .collect(Collectors.toList()); + if (getArchiveTransferGlobalMetadata() == null) setArchiveTransferGlobalMetadata(new GlobalMetadata()); + getArchiveTransferGlobalMetadata().comment = "Avec valeurs utilisables sur environnement de démo Vitam"; + getArchiveTransferGlobalMetadata().setNowFlag(true); + getArchiveTransferGlobalMetadata().messageIdentifier = "SIP SEDA de test"; + getArchiveTransferGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; + getArchiveTransferGlobalMetadata().codeListVersionsXmlData = " \n" + + " ReplyCodeListVersion0\n" + + " MessageDigestAlgorithmCodeListVersion0\n" + + " MimeTypeCodeListVersion0\n" + + " EncodingCodeListVersion0\n" + + " FileFormatCodeListVersion0\n" + + " CompressionAlgorithmCodeListVersion0\n" + + " DataObjectVersionCodeListVersion0\n" + + " StorageRuleCodeListVersion0\n" + + " AppraisalRuleCodeListVersion0\n" + + " AccessRuleCodeListVersion0\n" + + " DisseminationRuleCodeListVersion0\n" + + " ReuseRuleCodeListVersion0\n" + + " ClassificationRuleCodeListVersion0\n" + + " AuthorizationReasonCodeListVersion0\n" + + " RelationshipCodeListVersion0\n" + + " "; + getArchiveTransferGlobalMetadata().transferRequestReplyIdentifier = "Identifier3"; + getArchiveTransferGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; + getArchiveTransferGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; + } + + /** + * Gets the archive transfer global metadata. + * + * @return the archive transfer global metadata + */ + public GlobalMetadata getArchiveTransferGlobalMetadata() { + return globalMetadata; + } + + /** + * Sets the archive transfer global metadata. + * + * @param globalMetadata the new archive transfer global metadata + */ + public void setArchiveTransferGlobalMetadata(GlobalMetadata globalMetadata) { + this.globalMetadata = globalMetadata; + } + + /** + * Checks if is hierarchical archive units. + * + * @return true, if is hierarchical archive units + */ + public boolean isHierarchicalArchiveUnits() { + return hierarchicalArchiveUnits; + } + + /** + * Sets the hierarchical archive units. + * + * @param hierarchicalArchiveUnits the new hierarchical archive units + */ + public void setHierarchicalArchiveUnits(boolean hierarchicalArchiveUnits) { + this.hierarchicalArchiveUnits = hierarchicalArchiveUnits; + } + + /** + * Checks if is indented. + * + * @return true, if is indented + */ + public boolean isIndented() { + return indented; + } + + /** + * Sets the indented. + * + * @param indented the new indented + */ + public void setIndented(boolean indented) { + this.indented = indented; + } + + /** + * Is reindex boolean. + * + * @return the boolean + */ + public boolean isReindex() { + return reindex; + } + + /** + * Sets reindex. + * + * @param reindex the reindex + */ + public void setReindex(boolean reindex) { + this.reindex = reindex; + } + + /** + * Gets usage version selection mode. + * + * @return the usage version selection mode + */ + public int getUsageVersionSelectionMode() { + return usageVersionSelectionMode; + } + + /** + * Sets usage version selection mode. + * + * @param usageVersionSelectionMode the usage version selection mode + */ + public void setUsageVersionSelectionMode(int usageVersionSelectionMode) { + this.usageVersionSelectionMode = usageVersionSelectionMode; + } + + /** + * Gets max name size. + * + * @return the max name size + */ + public int getMaxNameSize() { + return maxNameSize; + } + + /** + * Sets max name size. + * + * @param maxNameSize the max name size + */ + public void setMaxNameSize(int maxNameSize) { + this.maxNameSize = maxNameSize; + } + + /** + * Is csv extended format boolean. + * + * @return the boolean + */ + public boolean isCsvExtendedFormat() { + return csvExtendedFormat; + } + + /** + * Sets csv extended format. + * + * @param csvExtendedFormat the csv extended format + */ + public void setCsvExtendedFormat(boolean csvExtendedFormat) { + this.csvExtendedFormat = csvExtendedFormat; + } + + /** + * Gets the management metadata xml data. + * + * @return the management metadata xml data + */ + public String getManagementMetadataXmlData() { + return managementMetadataXmlData; + } + + /** + * Sets the management metadata xml data. + * + * @param managementMetadataXmlData the new management metadata xml data + */ + public void setManagementMetadataXmlData(String managementMetadataXmlData) { + this.managementMetadataXmlData = managementMetadataXmlData; + } + + /** + * Gets on disk output. + * + * @return the on disk output + */ + public String getOnDiskOutput() { + return onDiskOutput; + } + + /** + * Sets on disk output. + * + * @param onDiskOutput the on disk output + */ + public void setOnDiskOutput(String onDiskOutput) { + this.onDiskOutput = onDiskOutput; + } + + /** + * Is metadata filter flag boolean. + * + * @return the boolean + */ + public boolean isMetadataFilterFlag() { + return metadataFilterFlag; + } + + /** + * Sets metadata filter flag. + * + * @param metadataFilterFlag the metadata filter flag + */ + public void setMetadataFilterFlag(boolean metadataFilterFlag) { + this.metadataFilterFlag = metadataFilterFlag; + } + + /** + * Gets kept metadata list. + * + * @return the kept metadata list + */ + public List getKeptMetadataList() { + return keptMetadataList; + } + + /** + * Sets kept metadata list. + * + * @param keptMetadataList the kept metadata list + */ + public void setKeptMetadataList(List keptMetadataList) { + this.keptMetadataList = keptMetadataList; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java index f848cc07..5a2c02d4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/InterfaceParameters.java @@ -67,19 +67,21 @@ public InterfaceParameters() { experimentalFlag = false; } - /** * Instantiates a new creation context. * * @param preferences the prefs */ public InterfaceParameters(Preferences preferences) { - structuredMetadataEditionFlag=Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("interfaceParameters.structuredEdtionFlag", "true")); + structuredMetadataEditionFlag = Boolean.parseBoolean( + preferences.getPrefProperties().getProperty("interfaceParameters.structuredEdtionFlag", "true") + ); debugFlag = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("interfaceParameters.debugFlag", "false")); + preferences.getPrefProperties().getProperty("interfaceParameters.debugFlag", "false") + ); experimentalFlag = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("interfaceParameters.experimentalFlag", "false")); + preferences.getPrefProperties().getProperty("interfaceParameters.experimentalFlag", "false") + ); } /** @@ -88,16 +90,20 @@ public InterfaceParameters(Preferences preferences) { * @param preferences the prefs */ public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("interfaceParameters.structuredEdtionFlag",Boolean.toString(structuredMetadataEditionFlag)); + preferences + .getPrefProperties() + .setProperty("interfaceParameters.structuredEdtionFlag", Boolean.toString(structuredMetadataEditionFlag)); preferences.getPrefProperties().setProperty("interfaceParameters.debugFlag", Boolean.toString(debugFlag)); - preferences.getPrefProperties().setProperty("interfaceParameters.experimentalFlag", Boolean.toString(experimentalFlag)); + preferences + .getPrefProperties() + .setProperty("interfaceParameters.experimentalFlag", Boolean.toString(experimentalFlag)); } /** * Sets the default prefs. */ public void setDefaultPrefs() { - structuredMetadataEditionFlag=true; + structuredMetadataEditionFlag = true; debugFlag = false; experimentalFlag = false; } @@ -157,4 +163,4 @@ public boolean isExperimentalFlag() { public void setExperimentalFlag(boolean experimentalFlag) { this.experimentalFlag = experimentalFlag; } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java index cffcaa5f..fba78858 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/MailImportContext.java @@ -48,7 +48,7 @@ */ public class MailImportContext extends CreationContext { -// prefs elements + // prefs elements /** * The extract message text file. */ @@ -82,7 +82,7 @@ public class MailImportContext extends CreationContext { */ String defaultCharsetName; -// session elements + // session elements /** * The mail folder. */ @@ -108,12 +108,17 @@ public MailImportContext() { * @param onDiskInput the on disk input * @param workDir the work dir */ - public MailImportContext(boolean extractMessageTextFile, - boolean extractMessageTextMetadata, - boolean extractAttachmentTextFile, - boolean extractAttachementMetadata, - boolean allowsExternalToolsForTextExtraction, - String protocol, String defaultCharsetName, String onDiskInput, String workDir) { + public MailImportContext( + boolean extractMessageTextFile, + boolean extractMessageTextMetadata, + boolean extractAttachmentTextFile, + boolean extractAttachementMetadata, + boolean allowsExternalToolsForTextExtraction, + String protocol, + String defaultCharsetName, + String onDiskInput, + String workDir + ) { super(onDiskInput, workDir); this.extractMessageTextFile = extractMessageTextFile; this.extractMessageTextMetadata = extractMessageTextMetadata; @@ -122,7 +127,7 @@ public MailImportContext(boolean extractMessageTextFile, this.allowsExternalToolsForTextExtraction = allowsExternalToolsForTextExtraction; this.protocol = protocol; this.mailFolder = ""; - this.defaultCharsetName=defaultCharsetName; + this.defaultCharsetName = defaultCharsetName; } /** @@ -133,30 +138,61 @@ public MailImportContext(boolean extractMessageTextFile, public MailImportContext(Preferences preferences) { super(preferences); this.extractMessageTextFile = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("importContext.mail.extractMessageTextFile", "false")); + preferences.getPrefProperties().getProperty("importContext.mail.extractMessageTextFile", "false") + ); this.extractMessageTextMetadata = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("importContext.mail.extractMessageTextMetadata", "true")); + preferences.getPrefProperties().getProperty("importContext.mail.extractMessageTextMetadata", "true") + ); this.extractAttachmentTextFile = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("importContext.mail.extractAttachmentTextFile", "true")); + preferences.getPrefProperties().getProperty("importContext.mail.extractAttachmentTextFile", "true") + ); this.extractAttachmentTextMetadata = Boolean.parseBoolean( - preferences.getPrefProperties().getProperty("importContext.mail.extractAttachmentTextMetadata", "false")); - this.allowsExternalToolsForTextExtraction = Boolean.parseBoolean(preferences.getPrefProperties().getProperty("importContext.mail.allowsExternalToolsForTextExtraction", "false")); + preferences.getPrefProperties().getProperty("importContext.mail.extractAttachmentTextMetadata", "false") + ); + this.allowsExternalToolsForTextExtraction = Boolean.parseBoolean( + preferences + .getPrefProperties() + .getProperty("importContext.mail.allowsExternalToolsForTextExtraction", "false") + ); this.protocol = preferences.getPrefProperties().getProperty("importContext.mail.protocol", "thunderbird"); this.mailFolder = ""; - this.defaultCharsetName = preferences.getPrefProperties().getProperty("importContext.mail.defaultCharsetName", "windows-1252"); + this.defaultCharsetName = preferences + .getPrefProperties() + .getProperty("importContext.mail.defaultCharsetName", "windows-1252"); } /* (non-Javadoc) * @see CreationContext#toPrefs(Prefs) */ public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("importContext.mail.extractMessageTextFile", Boolean.toString(extractMessageTextFile)); - preferences.getPrefProperties().setProperty("importContext.mail.extractMessageTextMetadata", Boolean.toString(extractMessageTextMetadata)); - preferences.getPrefProperties().setProperty("importContext.mail.extractAttachmentTextFile", Boolean.toString(extractAttachmentTextFile)); - preferences.getPrefProperties().setProperty("importContext.mail.extractAttachmentTextMetadata", Boolean.toString(extractAttachmentTextMetadata)); - preferences.getPrefProperties().setProperty("importContext.mail.allowsExternalToolsForTextExtraction", Boolean.toString(allowsExternalToolsForTextExtraction)); + preferences + .getPrefProperties() + .setProperty("importContext.mail.extractMessageTextFile", Boolean.toString(extractMessageTextFile)); + preferences + .getPrefProperties() + .setProperty("importContext.mail.extractMessageTextMetadata", Boolean.toString(extractMessageTextMetadata)); + preferences + .getPrefProperties() + .setProperty("importContext.mail.extractAttachmentTextFile", Boolean.toString(extractAttachmentTextFile)); + preferences + .getPrefProperties() + .setProperty( + "importContext.mail.extractAttachmentTextMetadata", + Boolean.toString(extractAttachmentTextMetadata) + ); + preferences + .getPrefProperties() + .setProperty( + "importContext.mail.allowsExternalToolsForTextExtraction", + Boolean.toString(allowsExternalToolsForTextExtraction) + ); preferences.getPrefProperties().setProperty("importContext.mail.protocol", (protocol == null ? "" : protocol)); - preferences.getPrefProperties().setProperty("importContext.mail.defaultCharsetName", (defaultCharsetName == null ? "" : defaultCharsetName)); + preferences + .getPrefProperties() + .setProperty( + "importContext.mail.defaultCharsetName", + (defaultCharsetName == null ? "" : defaultCharsetName) + ); } /* (non-Javadoc) @@ -171,7 +207,7 @@ public void setDefaultPrefs() { this.allowsExternalToolsForTextExtraction = false; this.protocol = "thunderbird"; this.mailFolder = ""; - this.defaultCharsetName="windows-1252"; + this.defaultCharsetName = "windows-1252"; } // Getters and setters @@ -301,7 +337,6 @@ public void setMailFolder(String mailFolder) { this.mailFolder = mailFolder; } - /** * Gets default charset name. * @@ -325,18 +360,12 @@ public void setOnDiskInput(String onDiskInput) { this.onDiskInput = onDiskInput; if (onDiskInput != null) { try { - if (Files.isDirectory(Paths.get(onDiskInput))) - setProtocol("thunderbird"); - else if (onDiskInput.endsWith(".pst")) - setProtocol("pst"); - else if (onDiskInput.endsWith(".msg")) - setProtocol("msg"); - else if (onDiskInput.endsWith(".eml")) - setProtocol("eml"); - else - setProtocol("mbox"); - } catch (Exception ignored) { - } + if (Files.isDirectory(Paths.get(onDiskInput))) setProtocol("thunderbird"); + else if (onDiskInput.endsWith(".pst")) setProtocol("pst"); + else if (onDiskInput.endsWith(".msg")) setProtocol("msg"); + else if (onDiskInput.endsWith(".eml")) setProtocol("eml"); + else setProtocol("mbox"); + } catch (Exception ignored) {} } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java index 6f8d4774..3e853fc2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/Preferences.java @@ -76,15 +76,13 @@ public class Preferences { */ private static Preferences instance; - /** * Gets the single instance of Prefs. * * @return single instance of Prefs */ public static Preferences getInstance() { - if (instance == null) - instance = new Preferences(); + if (instance == null) instance = new Preferences(); return instance; } @@ -94,8 +92,7 @@ public static Preferences getInstance() { private Preferences() { try { // to get the properties sorted by key when stored work for java 8/9/10 - prefProperties = new Properties(){ - + prefProperties = new Properties() { private static final long serialVersionUID = 1L; @Override @@ -105,15 +102,15 @@ public Set keySet() { @Override public Set> entrySet() { - Set> set1 = super.entrySet(); Set> set2 = new LinkedHashSet<>(set1.size()); - Iterator> iterator = set1.stream() - .sorted((o1, o2) -> o1.getKey().toString().compareTo(o2.getKey().toString())).iterator(); + Iterator> iterator = set1 + .stream() + .sorted((o1, o2) -> o1.getKey().toString().compareTo(o2.getKey().toString())) + .iterator(); - while (iterator.hasNext()) - set2.add(iterator.next()); + while (iterator.hasNext()) set2.add(iterator.next()); return set2; } @@ -124,26 +121,38 @@ public synchronized Enumeration keys() { } }; try { - prefPropertiesFilename=PREFERENCES_FILENAME; + prefPropertiesFilename = PREFERENCES_FILENAME; load(); } catch (ResipException e) { - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, - "Resip.GraphicApp: Le fichier de préférences global \"" + prefPropertiesFilename + "\" n'a pas " + - "été trouvé. Recherche de la version personnelle.",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.GLOBAL, + "Resip.GraphicApp: Le fichier de préférences global \"" + + prefPropertiesFilename + + "\" n'a pas " + + "été trouvé. Recherche de la version personnelle.", + e + ); try { - prefPropertiesFilename= Preferences.getDefaultWorkDir()+File.separator+PREFERENCES_FILENAME; + prefPropertiesFilename = Preferences.getDefaultWorkDir() + File.separator + PREFERENCES_FILENAME; load(); } catch (ResipException ee) { - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, - "Resip.GraphicApp: Le fichier de préférences personnel \"" + prefPropertiesFilename + "\" n'a pas non plus " + - "été trouvé. Ce fichier de préférences va être créé avec les valeurs par défaut.",ee); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.GLOBAL, + "Resip.GraphicApp: Le fichier de préférences personnel \"" + + prefPropertiesFilename + + "\" n'a pas non plus " + + "été trouvé. Ce fichier de préférences va être créé avec les valeurs par défaut.", + ee + ); createDefaultPrefs(); } } } catch (Exception e) { - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, - "Resip.GraphicApp: Erreur fatale, impossible de manipuler les préférences.",e); + ResipLogger.getGlobalLogger() + .log(ResipLogger.ERROR, "Resip.GraphicApp: Erreur fatale, impossible de manipuler les préférences.", e); System.exit(1); } } @@ -210,8 +219,12 @@ public void save(String filename) throws ResipException { try { Files.createDirectories(Paths.get(filename).getParent()); } catch (IOException e) { - throw new ResipException("Impossible de créer le répertoire des préférences ["+ - Paths.get(filename).getParent().toString()+"]", e); + throw new ResipException( + "Impossible de créer le répertoire des préférences [" + + Paths.get(filename).getParent().toString() + + "]", + e + ); } try (FileOutputStream fos = new FileOutputStream(filename)) { prefProperties.store(fos, "Resip preferences"); @@ -249,10 +262,10 @@ public void load(String filename) throws ResipException { * @return the default work dir */ public static String getDefaultWorkDir() { - if (System.getProperty("os.name").toLowerCase().contains("win")) - return System.getProperty("user.home") + File.separator + "Documents" + File.separator + "Resip"; - else - return System.getProperty("user.home") + File.separator + ".Resip"; + if (System.getProperty("os.name").toLowerCase().contains("win")) return ( + System.getProperty("user.home") + File.separator + "Documents" + File.separator + "Resip" + ); + else return System.getProperty("user.home") + File.separator + ".Resip"; } /** @@ -280,8 +293,7 @@ public String getPrefPropertiesFilename() { */ public String getPrefsLoadDir() { String result = prefProperties.getProperty("global.loadDir", ""); - if (result.isEmpty()) - result = System.getProperty("user.home"); + if (result.isEmpty()) result = System.getProperty("user.home"); return result; } @@ -308,8 +320,7 @@ public void setPrefsLoadDirFromChild(String loadDir) throws ResipException { */ public String getPrefsImportDir() throws ResipException { String result = prefProperties.getProperty("global.importDir", ""); - if (result.isEmpty()) - result = System.getProperty("user.home"); + if (result.isEmpty()) result = System.getProperty("user.home"); return result; } @@ -335,10 +346,9 @@ public void setPrefsImportDirFromChild(String importDir) throws ResipException { */ public String getPrefsExportDir() { String result = prefProperties.getProperty("global.exportDir", ""); - if (result.isEmpty()) - result = System.getProperty("user.home"); + if (result.isEmpty()) result = System.getProperty("user.home"); - return result; + return result; } /** @@ -349,7 +359,7 @@ public String getPrefsExportDir() { */ public void setPrefsExportDirFromChild(String exportDir) throws ResipException { Path tmp = Paths.get(exportDir).toAbsolutePath().normalize().getParent(); - if (tmp != null){ + if (tmp != null) { prefProperties.setProperty("global.exportDir", tmp.toString()); save(); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java index 2b2e4fe4..2fe729c8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/SIPImportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -49,8 +49,8 @@ public class SIPImportContext extends CreationContext { * Instantiates a new SIP import context. */ public SIPImportContext() { - this(null, null); - } + this(null, null); + } /** * Instantiates a new SIP import context. @@ -58,9 +58,9 @@ public SIPImportContext() { * @param onDiskInput the on disk input * @param workDir the work dir */ - public SIPImportContext(String onDiskInput, String workDir){ - super (onDiskInput, workDir); - } + public SIPImportContext(String onDiskInput, String workDir) { + super(onDiskInput, workDir); + } /** * Instantiates a new SIP import context. @@ -68,12 +68,11 @@ public SIPImportContext(String onDiskInput, String workDir){ * @param preferences the prefs */ public SIPImportContext(Preferences preferences) { - super(preferences); - } + super(preferences); + } - /* (non-Javadoc) - * @see CreationContext#toPrefs(Prefs) - */ - public void toPrefs(Preferences preferences) { - } + /* (non-Javadoc) + * @see CreationContext#toPrefs(Prefs) + */ + public void toPrefs(Preferences preferences) {} } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java index baeea5a6..1bff71d8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/TreatmentParameters.java @@ -77,9 +77,8 @@ public TreatmentParameters() { }); } - private String canonizeCategoryName(String category) { - return StringUtils.stripAccents(category).replaceAll("[^A-Za-z0-9]",""); + return StringUtils.stripAccents(category).replaceAll("[^A-Za-z0-9]", ""); } /** @@ -92,14 +91,18 @@ public TreatmentParameters(Preferences preferences) { this.sedaVersion = event.getNewVersion(); }); - final String categoriesString = preferences.getPrefProperties().getProperty("treatmentParameters.categoriesList", null); + final String categoriesString = preferences + .getPrefProperties() + .getProperty("treatmentParameters.categoriesList", null); if (categoriesString != null) { List categoryList = Arrays.asList(categoriesString.split("\\|")); categoryList.replaceAll(String::trim); formatByCategoryMap = new LinkedHashMap<>(); for (String category : categoryList) { - String formatsString = preferences.getPrefProperties().getProperty("treatmentParameters.categories." + canonizeCategoryName(category), ""); + String formatsString = preferences + .getPrefProperties() + .getProperty("treatmentParameters.categories." + canonizeCategoryName(category), ""); List formatList = Arrays.asList(formatsString.split("\\|")); formatList.replaceAll(String::trim); formatByCategoryMap.put(category, formatList); @@ -107,7 +110,9 @@ public TreatmentParameters(Preferences preferences) { } try { - dupMax = Integer.parseInt(preferences.getPrefProperties().getProperty("treatmentParameters.dupMax","1000")); + dupMax = Integer.parseInt( + preferences.getPrefProperties().getProperty("treatmentParameters.dupMax", "1000") + ); } catch (NumberFormatException e) { dupMax = 1000; } @@ -126,9 +131,16 @@ public TreatmentParameters(Preferences preferences) { * @param preferences the prefs */ public void toPrefs(Preferences preferences) { - preferences.getPrefProperties().setProperty("treatmentParameters.categoriesList", String.join("|",formatByCategoryMap.keySet())); - for (Map.Entry> e:formatByCategoryMap.entrySet()) { - preferences.getPrefProperties().setProperty("treatmentParameters.categories."+canonizeCategoryName(e.getKey()),String.join("|",e.getValue())); + preferences + .getPrefProperties() + .setProperty("treatmentParameters.categoriesList", String.join("|", formatByCategoryMap.keySet())); + for (Map.Entry> e : formatByCategoryMap.entrySet()) { + preferences + .getPrefProperties() + .setProperty( + "treatmentParameters.categories." + canonizeCategoryName(e.getKey()), + String.join("|", e.getValue()) + ); } preferences.getPrefProperties().setProperty("treatmentParameters.dupMax", Integer.toString(dupMax)); preferences.getPrefProperties().setProperty("treatmentParameters.seda2Version", sedaVersion.toString()); @@ -138,46 +150,231 @@ public void toPrefs(Preferences preferences) { * Sets the default prefs. */ public void setDefaultPrefs() { - formatByCategoryMap=new LinkedHashMap<>(); - - formatByCategoryMap.put("Base de données (access,filemaker...)",Arrays.asList("fmt/161", "fmt/194", "fmt/275", - "fmt/995", "fmt/1196", "x-fmt/1", "x-fmt/8", "x-fmt/9", "x-fmt/10", "x-fmt/66", "x-fmt/238", "x-fmt/239", - "x-fmt/240", "x-fmt/241", "x-fmt/318", "x-fmt/319")); - formatByCategoryMap.put("Chiffré",Arrays.asList("fmt/494", "fmt/754", "fmt/755")); - formatByCategoryMap.put("Compressé (zip,tar...)",Arrays.asList("fmt/484", "x-fmt/263", "x-fmt/265", "x-fmt/266", - "x-fmt/268")); - formatByCategoryMap.put("Dessin (svg,odg,autocad...)",Arrays.asList("fmt/21", "fmt/22", "fmt/23", "fmt/24", - "fmt/25", "fmt/26", "fmt/27", "fmt/28", "fmt/29", "fmt/30", "fmt/31", "fmt/32", "fmt/33", "fmt/34", - "fmt/35", "fmt/36")); - formatByCategoryMap.put("Exécutable",Arrays.asList("fmt/688", "fmt/689", "fmt-899", "fmt/900", "x-fmt/409", - "x-fmt/410", "x-fmt/411")); - formatByCategoryMap.put("HTML",Arrays.asList("fmt/96", "fmt/97", "fmt/98", "fmt/99", "fmt/100", "fmt/101", - "fmt/102", "fmt/103", "fmt/471")); - formatByCategoryMap.put("Image (jpg,jpg2000,tiff...)", Arrays.asList("fmt/3", "fmt/4", "fmt/11", "fmt/12", - "fmt/13", "fmt/41", "fmt/42", "fmt/43", "fmt/44", "fmt/150", "fmt/156", "fmt/353", "fmt/463", "fmt/529", - "fmt/645", "x-fmt/387", "x-fmt/390", "x-fmt/391", "x-fmt/392", "x-fmt/398")); - formatByCategoryMap.put("Messagerie (mbox,pst,eml...)",Arrays.asList("fmt/278", "fmt/720", "fmt/950", "x-fmt/248", - "x-fmt/249", "x-fmt/430")); - formatByCategoryMap.put("Pdf",Arrays.asList("fmt/14", "fmt/15", "fmt/16", "fmt/17", "fmt/18", "fmt/19", "fmt/20", - "fmt/95", "fmt/144", "fmt/145", "fmt/146", "fmt/147", "fmt/148", "fmt/157", "fmt/158", "fmt/276", - "fmt/354", "fmt/476", "fmt/477", "fmt/478", "fmt/479", "fmt/480", "fmt/481", "fmt/488", "fmt/489", - "fmt/490", "fmt/491", "fmt/492", "fmt/493", "fmt/1129")); - formatByCategoryMap.put("Présentation (ppt,pptx,odp...)",Arrays.asList("fmt/125", "fmt/126", "fmt/138", "fmt/179", - "fmt/181", "fmt/215", "fmt/292", "fmt/293", "x-fmt/88")); - formatByCategoryMap.put("Son (wave,mp3...)",Arrays.asList("fmt/1", "fmt/2", "fmt/6", "fmt/132", "fmt/134", - "fmt/141", "fmt/142", "fmt/527", "fmt/703", "fmt/704", "fmt/705", "fmt/706", "fmt/707", "fmt/708", - "fmt/709", "fmt/710", "fmt/711")); - formatByCategoryMap.put("Structuré (XML,json)",Arrays.asList("fmt/101", "fmt/817", "fmt/880")); - formatByCategoryMap.put("Tableur (csv,xls,xlsx,ods...)",Arrays.asList("fmt/55", "fmt/56", "fmt/57", "fmt/59", - "fmt/61", "fmt/62", "fmt/137", "fmt/175", "fmt/176", "fmt/177", "fmt/214", "fmt/294", "fmt/295", - "fmt/445", "x-fmt/18")); - formatByCategoryMap.put("Texte (doc,docx,odt...)", Arrays.asList("fmt/37", "fmt/38", "fmt/39", "fmt/40", "fmt/45", - "fmt/50", "fmt/51", "fmt/52", "fmt/53", "fmt/136", "fmt/258", "fmt/290", "fmt/291", "fmt/412", "fmt/609", - "fmt/754", "x-fmt/42", "x-fmt/43", "x-fmt/44", "x-fmt/64", "x-fmt/65", "x-fmt/273", "x-fmt/274", - "x-fmt/275", "x-fmt/276", "x-fmt/393", "x-fmt/394")); + formatByCategoryMap = new LinkedHashMap<>(); + + formatByCategoryMap.put( + "Base de données (access,filemaker...)", + Arrays.asList( + "fmt/161", + "fmt/194", + "fmt/275", + "fmt/995", + "fmt/1196", + "x-fmt/1", + "x-fmt/8", + "x-fmt/9", + "x-fmt/10", + "x-fmt/66", + "x-fmt/238", + "x-fmt/239", + "x-fmt/240", + "x-fmt/241", + "x-fmt/318", + "x-fmt/319" + ) + ); + formatByCategoryMap.put("Chiffré", Arrays.asList("fmt/494", "fmt/754", "fmt/755")); + formatByCategoryMap.put( + "Compressé (zip,tar...)", + Arrays.asList("fmt/484", "x-fmt/263", "x-fmt/265", "x-fmt/266", "x-fmt/268") + ); + formatByCategoryMap.put( + "Dessin (svg,odg,autocad...)", + Arrays.asList( + "fmt/21", + "fmt/22", + "fmt/23", + "fmt/24", + "fmt/25", + "fmt/26", + "fmt/27", + "fmt/28", + "fmt/29", + "fmt/30", + "fmt/31", + "fmt/32", + "fmt/33", + "fmt/34", + "fmt/35", + "fmt/36" + ) + ); + formatByCategoryMap.put( + "Exécutable", + Arrays.asList("fmt/688", "fmt/689", "fmt-899", "fmt/900", "x-fmt/409", "x-fmt/410", "x-fmt/411") + ); + formatByCategoryMap.put( + "HTML", + Arrays.asList("fmt/96", "fmt/97", "fmt/98", "fmt/99", "fmt/100", "fmt/101", "fmt/102", "fmt/103", "fmt/471") + ); + formatByCategoryMap.put( + "Image (jpg,jpg2000,tiff...)", + Arrays.asList( + "fmt/3", + "fmt/4", + "fmt/11", + "fmt/12", + "fmt/13", + "fmt/41", + "fmt/42", + "fmt/43", + "fmt/44", + "fmt/150", + "fmt/156", + "fmt/353", + "fmt/463", + "fmt/529", + "fmt/645", + "x-fmt/387", + "x-fmt/390", + "x-fmt/391", + "x-fmt/392", + "x-fmt/398" + ) + ); + formatByCategoryMap.put( + "Messagerie (mbox,pst,eml...)", + Arrays.asList("fmt/278", "fmt/720", "fmt/950", "x-fmt/248", "x-fmt/249", "x-fmt/430") + ); + formatByCategoryMap.put( + "Pdf", + Arrays.asList( + "fmt/14", + "fmt/15", + "fmt/16", + "fmt/17", + "fmt/18", + "fmt/19", + "fmt/20", + "fmt/95", + "fmt/144", + "fmt/145", + "fmt/146", + "fmt/147", + "fmt/148", + "fmt/157", + "fmt/158", + "fmt/276", + "fmt/354", + "fmt/476", + "fmt/477", + "fmt/478", + "fmt/479", + "fmt/480", + "fmt/481", + "fmt/488", + "fmt/489", + "fmt/490", + "fmt/491", + "fmt/492", + "fmt/493", + "fmt/1129" + ) + ); + formatByCategoryMap.put( + "Présentation (ppt,pptx,odp...)", + Arrays.asList( + "fmt/125", + "fmt/126", + "fmt/138", + "fmt/179", + "fmt/181", + "fmt/215", + "fmt/292", + "fmt/293", + "x-fmt/88" + ) + ); + formatByCategoryMap.put( + "Son (wave,mp3...)", + Arrays.asList( + "fmt/1", + "fmt/2", + "fmt/6", + "fmt/132", + "fmt/134", + "fmt/141", + "fmt/142", + "fmt/527", + "fmt/703", + "fmt/704", + "fmt/705", + "fmt/706", + "fmt/707", + "fmt/708", + "fmt/709", + "fmt/710", + "fmt/711" + ) + ); + formatByCategoryMap.put("Structuré (XML,json)", Arrays.asList("fmt/101", "fmt/817", "fmt/880")); + formatByCategoryMap.put( + "Tableur (csv,xls,xlsx,ods...)", + Arrays.asList( + "fmt/55", + "fmt/56", + "fmt/57", + "fmt/59", + "fmt/61", + "fmt/62", + "fmt/137", + "fmt/175", + "fmt/176", + "fmt/177", + "fmt/214", + "fmt/294", + "fmt/295", + "fmt/445", + "x-fmt/18" + ) + ); + formatByCategoryMap.put( + "Texte (doc,docx,odt...)", + Arrays.asList( + "fmt/37", + "fmt/38", + "fmt/39", + "fmt/40", + "fmt/45", + "fmt/50", + "fmt/51", + "fmt/52", + "fmt/53", + "fmt/136", + "fmt/258", + "fmt/290", + "fmt/291", + "fmt/412", + "fmt/609", + "fmt/754", + "x-fmt/42", + "x-fmt/43", + "x-fmt/44", + "x-fmt/64", + "x-fmt/65", + "x-fmt/273", + "x-fmt/274", + "x-fmt/275", + "x-fmt/276", + "x-fmt/393", + "x-fmt/394" + ) + ); formatByCategoryMap.put("Texte brut", List.of("x-fmt/111")); - formatByCategoryMap.put("Video (avi,mov,mpeg,mp4...)",Arrays.asList("fmt/5", "fmt/199", "fmt/569", "fmt/640", - "fmt/649", "fmt/797", "x-fmt/384", "x-fmt/385", "x-fmt/386")); + formatByCategoryMap.put( + "Video (avi,mov,mpeg,mp4...)", + Arrays.asList( + "fmt/5", + "fmt/199", + "fmt/569", + "fmt/640", + "fmt/649", + "fmt/797", + "x-fmt/384", + "x-fmt/385", + "x-fmt/386" + ) + ); formatByCategoryMap.put("Non connu", List.of("UNKNOWN")); formatByCategoryMap.put("Autres...", List.of("Other")); dupMax = 1000; @@ -243,11 +440,12 @@ public void setSedaVersion(SedaVersion version) { private SedaVersion parseSedaVersion(String version) { final List allowedVersions = List.of("1", "2", "3", "2.1", "2.2", "2.3"); final String defaultVersion = allowedVersions.get(0); - final String finalVersion = allowedVersions.stream() + final String finalVersion = allowedVersions + .stream() .filter(allowedVersion -> allowedVersion.equals(version)) .findFirst() .orElse(defaultVersion); return SedaVersion.from(finalVersion); } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java index eb026d15..d167a053 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/ZipImportContext.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.parameters; @@ -51,20 +51,20 @@ public class ZipImportContext extends DiskImportContext { * Instantiates a new zip import context. */ public ZipImportContext() { - this(null, null, null); - } + this(null, null, null); + } - /** - * Instantiates a new zip import context. - * - * @param preferences the prefs - */ - public ZipImportContext(Preferences preferences) { - super(preferences); - this.noLinkFlag=true; - } + /** + * Instantiates a new zip import context. + * + * @param preferences the prefs + */ + public ZipImportContext(Preferences preferences) { + super(preferences); + this.noLinkFlag = true; + } - /** + /** * Instantiates a new zip import context. * * @param ignorePatternList the ignore pattern list @@ -72,20 +72,19 @@ public ZipImportContext(Preferences preferences) { * @param workDir the work dir */ public ZipImportContext(List ignorePatternList, String onDiskInput, String workDir) { - super(ignorePatternList, true, onDiskInput, workDir); - } + super(ignorePatternList, true, onDiskInput, workDir); + } - /* (non-Javadoc) - * @see CreationContext#toPrefs(Prefs) - */ - public void toPrefs(Preferences preferences) { - } + /* (non-Javadoc) + * @see CreationContext#toPrefs(Prefs) + */ + public void toPrefs(Preferences preferences) {} - /* (non-Javadoc) - * @see CreationContext#setDefaultPrefs() - */ - public void setDefaultPrefs() { - super.setDefaultPrefs(); - noLinkFlag=true; - } + /* (non-Javadoc) + * @see CreationContext#setDefaultPrefs() + */ + public void setDefaultPrefs() { + super.setDefaultPrefs(); + noLinkFlag = true; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java index 8181de7b..c30505b5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/parameters/package-info.java @@ -36,4 +36,3 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ package fr.gouv.vitam.tools.resip.parameters; - diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java index ad194c7f..d1386e4c 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AnyXMLTypeEditor.java @@ -74,8 +74,9 @@ public class AnyXMLTypeEditor extends SEDAObjectEditor { */ public AnyXMLTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof AnyXMLType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof AnyXMLType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private AnyXMLType getAnyXMLTypeMetadata() { @@ -90,15 +91,16 @@ private AnyXMLType getAnyXMLTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new AnyXMLType("AnyXMLType", ""); - else - return new AnyXMLType("AnyXMLType", "<"+elementName+">Text1Text2"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new AnyXMLType("AnyXMLType", ""); + else return new AnyXMLType( + "AnyXMLType", + "<" + elementName + ">Text1Text2" + ); } @Override - public SEDAMetadata extractEditedObject() throws SEDALibException{ + public SEDAMetadata extractEditedObject() throws SEDALibException { getAnyXMLTypeMetadata().setRawXml(valueTextArea.getText()); return getAnyXMLTypeMetadata(); } @@ -110,12 +112,12 @@ public String getSummary() throws SEDALibException { @Override public void createSEDAObjectEditorPanel() throws SEDALibException { - JPanel labelPanel= new JPanel(); + JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); - JLabel label = new JLabel(translateTag("AnyXMLType")+" :"); + JLabel label = new JLabel(translateTag("AnyXMLType") + " :"); label.setToolTipText(getTag()); label.setFont(SEDAObjectEditor.LABEL_FONT); GridBagConstraints gbc = new GridBagConstraints(); @@ -125,10 +127,10 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; labelPanel.add(label, gbc); - JPanel editPanel= new JPanel(); + JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.rowHeights = new int[]{100}; - gbl.columnWeights = new double[]{1.0}; + gbl.rowHeights = new int[] { 100 }; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueTextArea = new RSyntaxTextArea(4, 80); @@ -143,9 +145,11 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JScrollPane scrollArea = new RTextScrollPane(valueTextArea); String xmlData; try { - xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString(getAnyXMLTypeMetadata().getRawXml()); + xmlData = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString( + getAnyXMLTypeMetadata().getRawXml() + ); } catch (SEDALibException e) { - xmlData=getAnyXMLTypeMetadata().getRawXml(); + xmlData = getAnyXMLTypeMetadata().getRawXml(); } valueTextArea.setText(xmlData); valueTextArea.setCaretPosition(0); @@ -155,7 +159,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 0; gbc.gridy = 0; editPanel.add(scrollArea, gbc); - JButton editButton=new JButton(); + JButton editButton = new JButton(); editButton.setIcon(new ImageIcon(getClass().getResource("/icon/text.png"))); editButton.setToolTipText("Ouvrir pour édition..."); editButton.setText(""); @@ -173,14 +177,12 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; editPanel.add(editButton, gbc); - this.sedaObjectEditorPanel =new SEDAObjectEditorSimplePanel(this,labelPanel,editPanel); + this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); } - private void editButton() - { + private void editButton() { XmlEditDialog xmlEditDialog = new XmlEditDialog(ResipGraphicApp.getTheWindow(), valueTextArea.getText()); xmlEditDialog.setVisible(true); - if (xmlEditDialog.getReturnValue()) - valueTextArea.setText((String) xmlEditDialog.getResult()); + if (xmlEditDialog.getReturnValue()) valueTextArea.setText((String) xmlEditDialog.getResult()); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java index b8e3b116..3e39d518 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/ArchiveUnitProfileEditor.java @@ -64,8 +64,9 @@ public class ArchiveUnitProfileEditor extends SEDAObjectEditor { */ public ArchiveUnitProfileEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof ArchiveUnitProfile)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof ArchiveUnitProfile)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private ArchiveUnitProfile getArchiveUnitProfileMetadata() { @@ -80,15 +81,13 @@ private ArchiveUnitProfile getArchiveUnitProfileMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new ArchiveUnitProfile( ""); - else - return new ArchiveUnitProfile( "AUP-00001"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new ArchiveUnitProfile(""); + else return new ArchiveUnitProfile("AUP-00001"); } @Override - public SEDAMetadata extractEditedObject() throws SEDALibException{ + public SEDAMetadata extractEditedObject() throws SEDALibException { getArchiveUnitProfileMetadata().setValue(valueTextField.getText()); return getArchiveUnitProfileMetadata(); } @@ -100,12 +99,12 @@ public String getSummary() throws SEDALibException { @Override public void createSEDAObjectEditorPanel() throws SEDALibException { - JPanel labelPanel= new JPanel(); + JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); - JLabel label = new JLabel(getName()+" :"); + JLabel label = new JLabel(getName() + " :"); label.setToolTipText(getTag()); label.setFont(SEDAObjectEditor.LABEL_FONT); GridBagConstraints gbc = new GridBagConstraints(); @@ -115,9 +114,9 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; labelPanel.add(label, gbc); - JPanel editPanel= new JPanel(); + JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); @@ -131,6 +130,6 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; editPanel.add(valueTextField, gbc); - this.sedaObjectEditorPanel =new SEDAObjectEditorSimplePanel(this,labelPanel,editPanel); + this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java index 65f863b5..9c4200cb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/BooleanTypeEditor.java @@ -64,8 +64,9 @@ public class BooleanTypeEditor extends SEDAObjectEditor { */ public BooleanTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof BooleanType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof BooleanType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private BooleanType getBooleanTypeMetadata() { @@ -80,27 +81,23 @@ private BooleanType getBooleanTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new BooleanType(elementName, null); - else - return new BooleanType(elementName, false); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new BooleanType(elementName, null); + else return new BooleanType(elementName, false); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueCheckBox.getModel().isArmed() && valueCheckBox.getModel().isPressed()) - getBooleanTypeMetadata().setValue(null); - else - getBooleanTypeMetadata().setValue(valueCheckBox.isSelected()); + if (valueCheckBox.getModel().isArmed() && valueCheckBox.getModel().isPressed()) getBooleanTypeMetadata() + .setValue(null); + else getBooleanTypeMetadata().setValue(valueCheckBox.isSelected()); return getBooleanTypeMetadata(); } @Override public String getSummary() throws SEDALibException { Boolean tmp = valueCheckBox.isSelected(); - if (valueCheckBox.getModel().isArmed() && valueCheckBox.getModel().isPressed()) - return ""; + if (valueCheckBox.getModel().isArmed() && valueCheckBox.getModel().isPressed()) return ""; return tmp.toString(); } @@ -108,7 +105,7 @@ public String getSummary() throws SEDALibException { public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -123,15 +120,14 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueCheckBox = new JCheckBox(); //indeterminate if (getBooleanTypeMetadata().getValue() == null) { valueCheckBox.getModel().setPressed(true); valueCheckBox.getModel().setArmed(true); - } else - valueCheckBox.setSelected(getBooleanTypeMetadata().getValue()); + } else valueCheckBox.setSelected(getBooleanTypeMetadata().getValue()); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.fill = GridBagConstraints.HORIZONTAL; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java index 565bb220..7fe7f2de 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTimeTypeEditor.java @@ -39,9 +39,10 @@ import com.github.lgooddatepicker.components.DateTimePicker; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.SEDAObjectEditorSimplePanel; -import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import fr.gouv.vitam.tools.sedalib.metadata.SEDAMetadata; import fr.gouv.vitam.tools.sedalib.metadata.namedtype.DateTimeType; +import fr.gouv.vitam.tools.sedalib.metadata.namedtype.DateTimeType.DateTimeFormatType; +import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import javax.swing.JLabel; @@ -54,8 +55,6 @@ import java.time.OffsetDateTime; import java.time.temporal.TemporalAccessor; -import fr.gouv.vitam.tools.sedalib.metadata.namedtype.DateTimeType.DateTimeFormatType; - /** * The DateTimeType object editor class. */ @@ -77,14 +76,14 @@ public class DateTimeTypeEditor extends SEDAObjectEditor { */ public DateTimeTypeEditor(SEDAMetadata metadata, SEDAObjectEditor parent) throws SEDALibException { super(metadata, parent); - - if (!(metadata instanceof DateTimeType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof DateTimeType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); this.update(getInitialValue()); valueDateTimePicker.setDateTimePermissive(getInitialValue().toLocalDateTime()); - valueDateTimePicker.addDateTimeChangeListener((event) -> { + valueDateTimePicker.addDateTimeChangeListener(event -> { LocalDateTime old = event.getOldDateTimePermissive(); LocalDateTime next = event.getNewDateTimePermissive(); @@ -145,10 +144,8 @@ private DateTimeType getInitialValue() { * @throws SEDALibException the seda lib exception */ public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new DateTimeType(elementName); - else - return new DateTimeType(elementName, LocalDateTime.of(1970, 1, 1, 1, 0, 0)); + if (minimal) return new DateTimeType(elementName); + else return new DateTimeType(elementName, LocalDateTime.of(1970, 1, 1, 1, 0, 0)); } @Override @@ -159,29 +156,23 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { LocalDateTime tmp = valueDateTimePicker.getDateTimePermissive(); - if (tmp != null) - return LocalDateTimeUtil.getFormattedDateTime(tmp); + if (tmp != null) return LocalDateTimeUtil.getFormattedDateTime(tmp); return ""; } @Override - public void createSEDAObjectEditorPanel() throws SEDALibException { - - } + public void createSEDAObjectEditorPanel() throws SEDALibException {} private String computeWarningMessage(DateTimeType dateTimeType) { String warning = ""; - if (dateTimeType.getFormatTypeEnum() == DateTimeFormatType.OFFSET_DATE_TIME) - warning += " (Timezone)"; + if (dateTimeType.getFormatTypeEnum() == DateTimeFormatType.OFFSET_DATE_TIME) warning += " (Timezone)"; TemporalAccessor ta = dateTimeType.getTemporalValue(); if (ta instanceof LocalDateTime) { LocalDateTime ldt = (LocalDateTime) ta; - if (ldt.getSecond() != 0 || ldt.getNano() != 0) - warning += " (Secondes/Millisecondes)"; + if (ldt.getSecond() != 0 || ldt.getNano() != 0) warning += " (Secondes/Millisecondes)"; } else if (ta instanceof OffsetDateTime) { OffsetDateTime odt = (OffsetDateTime) ta; - if (odt.getSecond() != 0 || odt.getNano() != 0) - warning += " (Secondes/Millisecondes)"; + if (odt.getSecond() != 0 || odt.getNano() != 0) warning += " (Secondes/Millisecondes)"; } if (!warning.isEmpty()) { @@ -192,8 +183,9 @@ private String computeWarningMessage(DateTimeType dateTimeType) { } private String computeWarningTooltip() { - return "Afin de ne pas perdre d'information, \n" + - "il est nécessaire de modifier les dates en mode non structuré."; + return ( + "Afin de ne pas perdre d'information, \n" + "il est nécessaire de modifier les dates en mode non structuré." + ); } private void updateWarning(DateTimeType dateTimeType) { diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java index 69ce6283..3f37878e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DateTypeEditor.java @@ -66,8 +66,7 @@ public class DateTypeEditor extends SEDAObjectEditor { */ public DateTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof DateType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof DateType)) throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); } private DateType getDateTypeMetadata() { @@ -82,11 +81,9 @@ private DateType getDateTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new DateType(elementName); - else - return new DateType(elementName, LocalDate.of(2000, 1, 1)); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new DateType(elementName); + else return new DateType(elementName, LocalDate.of(2000, 1, 1)); } @Override @@ -98,8 +95,7 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { LocalDate tmp = getDateTypeMetadata().getValue(); - if (tmp != null) - return tmp.toString(); + if (tmp != null) return tmp.toString(); return ""; } @@ -107,7 +103,7 @@ public String getSummary() throws SEDALibException { public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -122,7 +118,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueDatePicker = new DatePicker(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java index e924020b..b0e5ec65 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DigestTypeEditor.java @@ -79,8 +79,9 @@ public class DigestTypeEditor extends SEDAObjectEditor { */ public DigestTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof DigestType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof DigestType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private DigestType getDigestTypeMetadata() { @@ -95,11 +96,9 @@ private DigestType getDigestTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new DigestType(elementName, ""); - else - return new DigestType(elementName, "Hash", "SHA-512"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new DigestType(elementName, ""); + else return new DigestType(elementName, "Hash", "SHA-512"); } @Override @@ -114,8 +113,9 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { String result = ""; - if ((attributeTextField.getText() != null) && !attributeTextField.getText().isEmpty()) - result = "(" + attributeTextField.getText() + ")"; + if ((attributeTextField.getText() != null) && !attributeTextField.getText().isEmpty()) result = "(" + + attributeTextField.getText() + + ")"; return result + valueTextField.getText(); } @@ -125,12 +125,12 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { GridBagLayout gbl; AffineTransform affinetransform = new AffineTransform(); - FontRenderContext frc = new FontRenderContext(affinetransform,true,true); - algorithmWidth=(int) SEDAObjectEditor.LABEL_FONT.getStringBounds("SHA-512",frc).getWidth(); + FontRenderContext frc = new FontRenderContext(affinetransform, true, true); + algorithmWidth = (int) SEDAObjectEditor.LABEL_FONT.getStringBounds("SHA-512", frc).getWidth(); - labelGBL= new GridBagLayout(); - labelGBL.columnWidths = new int[]{0, 0, 0}; - labelGBL.columnWeights = new double[]{1.0, 0.0, 0.0}; + labelGBL = new GridBagLayout(); + labelGBL.columnWidths = new int[] { 0, 0, 0 }; + labelGBL.columnWeights = new double[] { 1.0, 0.0, 0.0 }; labelPanel.setLayout(labelGBL); beforeLabel = new JLabel(getName() + (getDigestTypeMetadata().getAlgorithm() == null ? "" : "(")); @@ -155,7 +155,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { algorithmButton.addActionListener(arg -> this.algorithmActivate()); labelPanel.add(algorithmButton, gbc); - attributeTextField = new JTextField(getDigestTypeMetadata().getAlgorithm(),5); + attributeTextField = new JTextField(getDigestTypeMetadata().getAlgorithm(), 5); attributeTextField.setFont(SEDAObjectEditor.MINI_EDIT_FONT); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); @@ -167,11 +167,11 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { if (getDigestTypeMetadata().getAlgorithm() == null) { algorithmButton.setVisible(true); attributeTextField.setVisible(false); - labelGBL.columnWidths = new int[]{0, 0, 0}; + labelGBL.columnWidths = new int[] { 0, 0, 0 }; } else { algorithmButton.setVisible(false); attributeTextField.setVisible(true); - labelGBL.columnWidths = new int[]{0,algorithmWidth, 0}; + labelGBL.columnWidths = new int[] { 0, algorithmWidth, 0 }; } innerLabel = new JLabel((getDigestTypeMetadata().getAlgorithm() == null ? ":" : ") :")); @@ -186,7 +186,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); @@ -224,13 +224,13 @@ public void setValue(String hash, String algorithm) { if (algorithm == null) { algorithmButton.setVisible(true); attributeTextField.setVisible(false); - labelGBL.columnWidths = new int[]{0,0, 0}; + labelGBL.columnWidths = new int[] { 0, 0, 0 }; beforeLabel.setText(getName()); innerLabel.setText(" :"); } else { algorithmButton.setVisible(false); attributeTextField.setVisible(true); - labelGBL.columnWidths = new int[]{0,algorithmWidth, 0}; + labelGBL.columnWidths = new int[] { 0, algorithmWidth, 0 }; beforeLabel.setText(getName() + "("); innerLabel.setText(") :"); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java index 62950ea9..a9d5839f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DoubleFilter.java @@ -45,31 +45,28 @@ * The type Double filter. */ public class DoubleFilter extends DocumentFilter { + @Override - public void replace(FilterBypass fb, int offs, int length, - String str, AttributeSet a) throws BadLocationException { - String number=fb.getDocument().getText(0,fb.getDocument().getLength()); - number=number.substring(0,offs)+str+number.substring(offs+length); + public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a) throws BadLocationException { + String number = fb.getDocument().getText(0, fb.getDocument().getLength()); + number = number.substring(0, offs) + str + number.substring(offs + length); try { Double.parseDouble(number); - } - catch (NumberFormatException e){ + } catch (NumberFormatException e) { return; } super.replace(fb, offs, length, str, a); } @Override - public void insertString(FilterBypass fb, int offs, String str, - AttributeSet a) throws BadLocationException { - String number=fb.getDocument().getText(0,fb.getDocument().getLength()); - number=number.substring(0,offs)+str+number.substring(offs); + public void insertString(FilterBypass fb, int offs, String str, AttributeSet a) throws BadLocationException { + String number = fb.getDocument().getText(0, fb.getDocument().getLength()); + number = number.substring(0, offs) + str + number.substring(offs); try { Double.parseDouble(number); - } - catch (NumberFormatException e){ + } catch (NumberFormatException e) { return; } super.insertString(fb, offs, str, a); } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java index b4a060a5..d37235a4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/EnumTypeEditor.java @@ -57,7 +57,7 @@ public class EnumTypeEditor extends SEDAObjectEditor { */ private JComboBox valueComboBox; - /** + /** * Instantiates a new EnumType editor. * * @param metadata the EnumType editedObject @@ -66,8 +66,7 @@ public class EnumTypeEditor extends SEDAObjectEditor { */ public EnumTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof EnumType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof EnumType)) throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); } private EnumType getEnumTypeMetadata() { @@ -82,32 +81,31 @@ private EnumType getEnumTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - List enumValues= EnumTypeConstants.enumListMap.get(elementName); - if (enumValues==null) - throw new SEDALibException("Type Enuméré ["+elementName+"] inconnu"); - return new EnumType(elementName,enumValues.get(0)); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + List enumValues = EnumTypeConstants.enumListMap.get(elementName); + if (enumValues == null) throw new SEDALibException("Type Enuméré [" + elementName + "] inconnu"); + return new EnumType(elementName, enumValues.get(0)); } @Override - public SEDAMetadata extractEditedObject() throws SEDALibException{ - getEnumTypeMetadata().setValue((String)(valueComboBox.getSelectedItem())); + public SEDAMetadata extractEditedObject() throws SEDALibException { + getEnumTypeMetadata().setValue((String) (valueComboBox.getSelectedItem())); return getEnumTypeMetadata(); } @Override public String getSummary() throws SEDALibException { - return (String)(valueComboBox.getSelectedItem()); + return (String) (valueComboBox.getSelectedItem()); } @Override public void createSEDAObjectEditorPanel() throws SEDALibException { - JPanel labelPanel= new JPanel(); + JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); - JLabel label = new JLabel(getName()+" :"); + JLabel label = new JLabel(getName() + " :"); label.setToolTipText(getTag()); label.setFont(SEDAObjectEditor.LABEL_FONT); GridBagConstraints gbc = new GridBagConstraints(); @@ -117,15 +115,16 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; labelPanel.add(label, gbc); - JPanel editPanel= new JPanel(); + JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); - List enumValues= EnumTypeConstants.enumListMap.get(getEnumTypeMetadata().elementName); - if (enumValues==null) - throw new SEDALibException("Type Enuméré ["+getEnumTypeMetadata().elementName+"] inconnu"); - valueComboBox=new JComboBox(enumValues.toArray(new String[0])); + List enumValues = EnumTypeConstants.enumListMap.get(getEnumTypeMetadata().elementName); + if (enumValues == null) throw new SEDALibException( + "Type Enuméré [" + getEnumTypeMetadata().elementName + "] inconnu" + ); + valueComboBox = new JComboBox(enumValues.toArray(new String[0])); valueComboBox.setEditable(true); valueComboBox.getEditor().getEditorComponent().setFocusable(false); valueComboBox.setFont(SEDAObjectEditor.EDIT_FONT); @@ -137,6 +136,6 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; editPanel.add(valueComboBox, gbc); - this.sedaObjectEditorPanel =new SEDAObjectEditorSimplePanel(this,labelPanel,editPanel); + this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java index ac9a6610..956a31d5 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerFilter.java @@ -45,31 +45,28 @@ * The type Integer filter. */ public class IntegerFilter extends DocumentFilter { + @Override - public void replace(FilterBypass fb, int offs, int length, - String str, AttributeSet a) throws BadLocationException { - String number=fb.getDocument().getText(0,fb.getDocument().getLength()); - number=number.substring(0,offs)+str+number.substring(offs+length); + public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a) throws BadLocationException { + String number = fb.getDocument().getText(0, fb.getDocument().getLength()); + number = number.substring(0, offs) + str + number.substring(offs + length); try { Long.parseLong(number); - } - catch (NumberFormatException e){ + } catch (NumberFormatException e) { return; } super.replace(fb, offs, length, str, a); } @Override - public void insertString(FilterBypass fb, int offs, String str, - AttributeSet a) throws BadLocationException { - String number=fb.getDocument().getText(0,fb.getDocument().getLength()); - number=number.substring(0,offs)+str+number.substring(offs); + public void insertString(FilterBypass fb, int offs, String str, AttributeSet a) throws BadLocationException { + String number = fb.getDocument().getText(0, fb.getDocument().getLength()); + number = number.substring(0, offs) + str + number.substring(offs); try { Long.parseLong(number); - } - catch (NumberFormatException e){ + } catch (NumberFormatException e) { return; } super.insertString(fb, offs, str, a); } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java index 1fe6452b..5bd1da24 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/IntegerTypeEditor.java @@ -66,8 +66,9 @@ public class IntegerTypeEditor extends SEDAObjectEditor { */ public IntegerTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof IntegerType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof IntegerType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private IntegerType getIntegerTypeMetadata() { @@ -82,19 +83,15 @@ private IntegerType getIntegerTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new IntegerType(elementName); - else - return new IntegerType(elementName, 42); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new IntegerType(elementName); + else return new IntegerType(elementName, 42); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueTextField.getText().isEmpty()) - getIntegerTypeMetadata().setValue(null); - else - getIntegerTypeMetadata().setValue(Long.parseLong(valueTextField.getText())); + if (valueTextField.getText().isEmpty()) getIntegerTypeMetadata().setValue(null); + else getIntegerTypeMetadata().setValue(Long.parseLong(valueTextField.getText())); return getIntegerTypeMetadata(); } @@ -107,7 +104,7 @@ public String getSummary() throws SEDALibException { public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -122,14 +119,16 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWidths = new int[]{100, 0}; - gbl.columnWeights = new double[]{0.0, 1.0}; + gbl.columnWidths = new int[] { 100, 0 }; + gbl.columnWeights = new double[] { 0.0, 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); DocumentFilter filter = new IntegerFilter(); ((AbstractDocument) valueTextField.getDocument()).setDocumentFilter(filter); - valueTextField.setText((getIntegerTypeMetadata().getValue() == null ? "" : Long.toString(getIntegerTypeMetadata().getValue()))); + valueTextField.setText( + (getIntegerTypeMetadata().getValue() == null ? "" : Long.toString(getIntegerTypeMetadata().getValue())) + ); valueTextField.setFont(SEDAObjectEditor.EDIT_FONT); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java index 8cd759e8..9a75c3c2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/LinearDimensionTypeEditor.java @@ -67,8 +67,9 @@ public class LinearDimensionTypeEditor extends SEDAObjectEditor { */ public LinearDimensionTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof LinearDimensionType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof LinearDimensionType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private LinearDimensionType getLinearDimensionTypeMetadata() { @@ -83,33 +84,32 @@ private LinearDimensionType getLinearDimensionTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new LinearDimensionType(elementName); - else - return new LinearDimensionType(elementName, 42.42, "metre"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new LinearDimensionType(elementName); + else return new LinearDimensionType(elementName, 42.42, "metre"); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueTextField.getText().isEmpty()) - getLinearDimensionTypeMetadata().setValue(null); - else - getLinearDimensionTypeMetadata().setValue(Double.parseDouble(valueTextField.getText())); + if (valueTextField.getText().isEmpty()) getLinearDimensionTypeMetadata().setValue(null); + else getLinearDimensionTypeMetadata().setValue(Double.parseDouble(valueTextField.getText())); getLinearDimensionTypeMetadata().setUnit((String) (unitComboBox.getSelectedItem())); return getLinearDimensionTypeMetadata(); } @Override public String getSummary() throws SEDALibException { - return (valueTextField.getText() == null ? "" : valueTextField.getText() + " ") + (unitComboBox.getSelectedItem()==null?"":unitComboBox.getSelectedItem()); + return ( + (valueTextField.getText() == null ? "" : valueTextField.getText() + " ") + + (unitComboBox.getSelectedItem() == null ? "" : unitComboBox.getSelectedItem()) + ); } @Override public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -124,14 +124,18 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWidths = new int[]{100, 0}; - gbl.columnWeights = new double[]{0.0, 1.0}; + gbl.columnWidths = new int[] { 100, 0 }; + gbl.columnWeights = new double[] { 0.0, 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); DocumentFilter filter = new DoubleFilter(); ((AbstractDocument) valueTextField.getDocument()).setDocumentFilter(filter); - valueTextField.setText((getLinearDimensionTypeMetadata().getValue() == null ? "" : Double.toString(getLinearDimensionTypeMetadata().getValue()))); + valueTextField.setText( + (getLinearDimensionTypeMetadata().getValue() == null + ? "" + : Double.toString(getLinearDimensionTypeMetadata().getValue())) + ); valueTextField.setFont(SEDAObjectEditor.EDIT_FONT); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java index e8c44469..69c29944 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RelationshipEditor.java @@ -37,13 +37,9 @@ */ package fr.gouv.vitam.tools.resip.sedaobjecteditor; -import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; -import fr.gouv.vitam.tools.resip.frame.BigTextEditDialog; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.AutomaticGrowingTextArea; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.SEDAObjectEditorSimplePanel; import fr.gouv.vitam.tools.sedalib.metadata.SEDAMetadata; import fr.gouv.vitam.tools.sedalib.metadata.data.Relationship; -import fr.gouv.vitam.tools.sedalib.metadata.namedtype.TextType; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import javax.swing.*; @@ -86,8 +82,9 @@ public class RelationshipEditor extends SEDAObjectEditor { */ public RelationshipEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof Relationship)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof Relationship)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private Relationship getRelationshipMetadata() { @@ -102,7 +99,7 @@ private Relationship getRelationshipMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { return new Relationship(); } @@ -120,8 +117,9 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { String result = ""; - if ((attributeTargetField.getText() != null) && !attributeTargetField.getText().isEmpty()) - result = "(" + attributeTargetField.getText() + ")"; + if ((attributeTargetField.getText() != null) && !attributeTargetField.getText().isEmpty()) result = "(" + + attributeTargetField.getText() + + ")"; return result; } @@ -136,8 +134,8 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { typeWidth = (int) SEDAObjectEditor.LABEL_FONT.getStringBounds("0123456789", frc).getWidth(); labelGBL = new GridBagLayout(); - labelGBL.columnWidths = new int[]{0, targetWidth, typeWidth,0}; - labelGBL.columnWeights = new double[]{1.0, 0.0, 0.0,0.0}; + labelGBL.columnWidths = new int[] { 0, targetWidth, typeWidth, 0 }; + labelGBL.columnWeights = new double[] { 1.0, 0.0, 0.0, 0.0 }; labelPanel.setLayout(labelGBL); beforeLabel = new JLabel(getName() + (getRelationshipMetadata().getTarget() == null ? "" : "(")); @@ -226,8 +224,8 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0, 0.0}; - gbl.rowWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0, 0.0 }; + gbl.rowWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java index df686599..df843567 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/RuleEditor.java @@ -79,8 +79,7 @@ public class RuleEditor extends SEDAObjectEditor { */ public RuleEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof Rule)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof Rule)) throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); } private Rule getRuleMetadata() { @@ -95,11 +94,9 @@ private Rule getRuleMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new Rule("", null); - else - return new Rule("Text", LocalDate.of(2000, 1, 1)); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new Rule("", null); + else return new Rule("Text", LocalDate.of(2000, 1, 1)); } @Override @@ -111,7 +108,7 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { - LocalDate tmp=startDatePicker.getDate(); + LocalDate tmp = startDatePicker.getDate(); return ruleIDTextField.getText() + (tmp == null ? "" : ", " + tmp); } @@ -119,7 +116,7 @@ public String getSummary() throws SEDALibException { public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); ruleIDTextField = new JTextField(); @@ -132,9 +129,10 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 0; gbc.gridy = 0; editPanel.add(ruleIDTextField, gbc); - int height= SEDAObjectEditor.EDIT_FONT.getSize(); - if (ruleIDTextField.getBorder()!=null) - height+=ruleIDTextField.getBorder().getBorderInsets(ruleIDTextField).bottom+ruleIDTextField.getBorder().getBorderInsets(ruleIDTextField).top; + int height = SEDAObjectEditor.EDIT_FONT.getSize(); + if (ruleIDTextField.getBorder() != null) height += + ruleIDTextField.getBorder().getBorderInsets(ruleIDTextField).bottom + + ruleIDTextField.getBorder().getBorderInsets(ruleIDTextField).top; startDatePicker = new DatePicker(); startDatePicker.setDate(getRuleMetadata().getStartDate()); @@ -147,11 +145,11 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.rowHeights = new int[]{height,height}; - gbl.columnWeights = new double[]{1.0}; + gbl.rowHeights = new int[] { height, height }; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); - JLabel label = new JLabel(translateTag("Rule")+" :"); + JLabel label = new JLabel(translateTag("Rule") + " :"); label.setToolTipText("Rule"); label.setFont(SEDAObjectEditor.LABEL_FONT); gbc = new GridBagConstraints(); @@ -161,7 +159,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; labelPanel.add(label, gbc); - JLabel dateLabel = new JLabel(translateTag("StartDate")+" :"); + JLabel dateLabel = new JLabel(translateTag("StartDate") + " :"); dateLabel.setToolTipText("StartDate"); dateLabel.setFont(SEDAObjectEditor.LABEL_FONT); gbc = new GridBagConstraints(); @@ -176,8 +174,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { private static class RuleEditorPanel extends SEDAObjectEditorSimplePanel { - public RuleEditorPanel(RuleEditor ruleEditor, - JPanel labelPanel, JPanel editPanel) throws SEDALibException { + public RuleEditorPanel(RuleEditor ruleEditor, JPanel labelPanel, JPanel editPanel) throws SEDALibException { super(ruleEditor, labelPanel, editPanel); } @@ -190,8 +187,10 @@ public void lessButton() { List ruleMetadataKindList = ((RuleType) objectEditor.getFather().getEditedObject()).getRuleMetadataKindList(); - List itemsToDelete = - prepareEditorListToDelete(rulesEditorList, ruleMetadataKindList); + List itemsToDelete = prepareEditorListToDelete( + rulesEditorList, + ruleMetadataKindList + ); for (SEDAObjectEditor sedaObjectEditor : itemsToDelete) { ((CompositeEditor) objectEditor.getFather()).removeChild(sedaObjectEditor); @@ -199,18 +198,22 @@ public void lessButton() { super.lessButton(); } - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } - private List prepareEditorListToDelete(List rulesEditorList, - List ruleMetadataKindList) { + private List prepareEditorListToDelete( + List rulesEditorList, + List ruleMetadataKindList + ) { List itemsToDelete = new ArrayList<>(); int ruleIndexToDelete = retrieveRuleIndex(); - for (SEDAObjectEditor ruleObjectEditor : rulesEditorList - .subList(ruleIndexToDelete + 1, rulesEditorList.size())) { - if (ruleMetadataKindList - .contains(((NamedTypeMetadata) ruleObjectEditor.getEditedObject()).elementName)) { + for (SEDAObjectEditor ruleObjectEditor : rulesEditorList.subList( + ruleIndexToDelete + 1, + rulesEditorList.size() + )) { + if ( + ruleMetadataKindList.contains(((NamedTypeMetadata) ruleObjectEditor.getEditedObject()).elementName) + ) { itemsToDelete.add(ruleObjectEditor); } else { break; @@ -220,10 +223,12 @@ private List prepareEditorListToDelete(List } private int retrieveRuleIndex() { - int index = ((RuleTypeEditor) objectEditor.getFather()).objectEditorList.stream() - .map(SEDAObjectEditor::getEditedObject).collect(Collectors.toList()) - .indexOf(objectEditor.getEditedObject()); - if(index == -1) { + int index = + ((RuleTypeEditor) objectEditor.getFather()).objectEditorList.stream() + .map(SEDAObjectEditor::getEditedObject) + .collect(Collectors.toList()) + .indexOf(objectEditor.getEditedObject()); + if (index == -1) { throw new IllegalStateException("Cannot find rule to delete index"); } return index; @@ -236,19 +241,24 @@ public void addButton() { try { List ruleMetadataKindList = ((RuleType) objectEditor.getFather().getEditedObject()).getRuleMetadataKindList(); - extensionList = ruleMetadataKindList.stream().map(e -> new ImmutablePair<>(e, translateTag(e))).collect( - Collectors.toList()); + extensionList = ruleMetadataKindList + .stream() + .map(e -> new ImmutablePair<>(e, translateTag(e))) + .collect(Collectors.toList()); } catch (SEDALibException e) { extensionList = null; } if ((extensionList != null) && !extensionList.isEmpty()) { - for (Pair names : extensionList) { + for (Pair names : extensionList) { JMenuItem mi = new JMenuItem(names.getValue()); - mi.addActionListener((ev) -> { + mi.addActionListener(ev -> { if (objectEditor.getFather() != null) { try { - ((RuleTypeEditor) objectEditor.getFather()).addChildTo(ev.getActionCommand(), (Rule) objectEditor.getEditedObject()); + ((RuleTypeEditor) objectEditor.getFather()).addChildTo( + ev.getActionCommand(), + (Rule) objectEditor.getEditedObject() + ); objectEditor.getFather().getSEDAObjectEditorPanelTopParent().validate(); } catch (SEDALibException e) { System.err.println(getAllJavaStackString(e)); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java index 9681e442..dadc9d4b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditor.java @@ -60,7 +60,7 @@ *

    * The data is in the SEDAMetadata... objects, and the visual is in SEDAObjectEditorPanels. */ -abstract public class SEDAObjectEditor { +public abstract class SEDAObjectEditor { /** * The SEDA object, either SEDAMetadata or high-level objects. @@ -126,33 +126,37 @@ abstract public class SEDAObjectEditor { * The constant COMPOSITE_LABEL_COLOR. */ public static Color COMPOSITE_LABEL_COLOR = new Color( - Math.min(GENERAL_FOREGROUND.getRed() + 64, 255), - Math.min(GENERAL_FOREGROUND.getGreen() + 64, 255), - Math.min(GENERAL_FOREGROUND.getBlue() + 200, 255)); + Math.min(GENERAL_FOREGROUND.getRed() + 64, 255), + Math.min(GENERAL_FOREGROUND.getGreen() + 64, 255), + Math.min(GENERAL_FOREGROUND.getBlue() + 200, 255) + ); /** * The constant COMPOSITE_LABEL_SEPARATOR_COLOR. */ public static Color COMPOSITE_LABEL_SEPARATOR_COLOR = new Color( - (int) (GENERAL_BACKGROUND.getRed() * 0.9), - (int) (GENERAL_BACKGROUND.getGreen() * 0.9), - (int) (GENERAL_BACKGROUND.getBlue() * 0.9)); + (int) (GENERAL_BACKGROUND.getRed() * 0.9), + (int) (GENERAL_BACKGROUND.getGreen() * 0.9), + (int) (GENERAL_BACKGROUND.getBlue() * 0.9) + ); /** * The constant COMPOSITE_LABEL_MARKUP_COLOR. */ public static Color COMPOSITE_LABEL_MARKUP_COLOR = new Color( - (int) (GENERAL_BACKGROUND.getRed() * 0.4), - (int) (GENERAL_BACKGROUND.getGreen() * 0.4), - (int) (GENERAL_BACKGROUND.getBlue() * 0.4)); + (int) (GENERAL_BACKGROUND.getRed() * 0.4), + (int) (GENERAL_BACKGROUND.getGreen() * 0.4), + (int) (GENERAL_BACKGROUND.getBlue() * 0.4) + ); /** * The constant COMPOSITE_LABEL_ATTRIBUTE_COLOR. */ public static Color COMPOSITE_LABEL_ATTRIBUTE_COLOR = new Color( - (int) (GENERAL_BACKGROUND.getRed() * 0.7), - 0, - (int) (GENERAL_BACKGROUND.getBlue() * 0.7)); + (int) (GENERAL_BACKGROUND.getRed() * 0.7), + 0, + (int) (GENERAL_BACKGROUND.getBlue() * 0.7) + ); // // All static methods dealing with SEDAMetadata and SEDAMetadata editors @@ -180,7 +184,9 @@ private static Class getMetadataClass(String simpleMetadataType) throws SEDALibE try { result = Class.forName(metadataType); } catch (ClassNotFoundException e5) { - throw new SEDALibException("Le type de métadonnée [" + simpleMetadataType + "] n'est pas connu"); + throw new SEDALibException( + "Le type de métadonnée [" + simpleMetadataType + "] n'est pas connu" + ); } } } @@ -198,22 +204,32 @@ private static Class getMetadataClass(String simpleMetadataType) throws SEDALibE * @return the seda editedObject * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata createSEDAMetadataSample(String metadataType, String elementName, boolean minimal) throws SEDALibException { + public static SEDAMetadata createSEDAMetadataSample(String metadataType, String elementName, boolean minimal) + throws SEDALibException { SEDAMetadata result; try { String objectEditorType = "fr.gouv.vitam.tools.resip.sedaobjecteditor." + metadataType + "Editor"; Class objectEditorClass = Class.forName(objectEditorType); try { - result = (SEDAMetadata) objectEditorClass.getMethod("getSEDAMetadataSample", String.class, boolean.class).invoke(null, elementName,minimal); + result = (SEDAMetadata) objectEditorClass + .getMethod("getSEDAMetadataSample", String.class, boolean.class) + .invoke(null, elementName, minimal); } catch (IllegalAccessException | NoSuchMethodException e) { - throw new SEDALibException("La création d'un exemple de la métadonnée de type [" + metadataType + "] n'est pas possible", e); + throw new SEDALibException( + "La création d'un exemple de la métadonnée de type [" + metadataType + "] n'est pas possible", + e + ); } catch (InvocationTargetException te) { - throw new SEDALibException("La création d'un exemple de la métadonnée [" + metadataType + "] a généré une erreur", te.getTargetException()); + throw new SEDALibException( + "La création d'un exemple de la métadonnée [" + metadataType + "] a généré une erreur", + te.getTargetException() + ); } } catch (ClassNotFoundException e1) { Class objectClass = getMetadataClass(metadataType); - if (!ComplexListType.class.isAssignableFrom(objectClass)) - throw new SEDALibException("L'éditeur de métadonnée [" + metadataType + "] n'existe pas"); + if (!ComplexListType.class.isAssignableFrom(objectClass)) throw new SEDALibException( + "L'éditeur de métadonnée [" + metadataType + "] n'existe pas" + ); result = ComplexListTypeEditor.getSEDAMetadataSample(objectClass, elementName, minimal); } return result; @@ -227,7 +243,8 @@ static public SEDAMetadata createSEDAMetadataSample(String metadataType, String * @return the SEDA object editor * @throws SEDALibException the seda lib exception */ - static public SEDAObjectEditor createSEDAObjectEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { + public static SEDAObjectEditor createSEDAObjectEditor(SEDAMetadata metadata, SEDAObjectEditor father) + throws SEDALibException { SEDAObjectEditor result; if (metadata instanceof RuleType) { result = new RuleTypeEditor(metadata, father); @@ -240,14 +257,25 @@ static public SEDAObjectEditor createSEDAObjectEditor(SEDAMetadata metadata, SED try { objectEditorClass = Class.forName(objectEditorType); } catch (ClassNotFoundException e) { - throw new SEDALibException("La métadonnée de type [" + metadata.getClass().getSimpleName() + "] n'a pas d'éditeur", e); + throw new SEDALibException( + "La métadonnée de type [" + metadata.getClass().getSimpleName() + "] n'a pas d'éditeur", + e + ); } try { - result = (SEDAObjectEditor) objectEditorClass.getConstructor(SEDAMetadata.class, SEDAObjectEditor.class).newInstance(metadata, father); + result = (SEDAObjectEditor) objectEditorClass + .getConstructor(SEDAMetadata.class, SEDAObjectEditor.class) + .newInstance(metadata, father); } catch (InstantiationException | IllegalAccessException | NoSuchMethodException e) { - throw new SEDALibException("La création d'un éditeur de la métadonnée de type [" + objectEditorType + "] n'est pas possible", e); + throw new SEDALibException( + "La création d'un éditeur de la métadonnée de type [" + objectEditorType + "] n'est pas possible", + e + ); } catch (InvocationTargetException te) { - throw new SEDALibException("La création d'un éditeur de la métadonnée [" + metadata.toString() + "] a généré une erreur", te.getTargetException()); + throw new SEDALibException( + "La création d'un éditeur de la métadonnée [" + metadata.toString() + "] a généré une erreur", + te.getTargetException() + ); } } return result; @@ -263,8 +291,12 @@ static public SEDAObjectEditor createSEDAObjectEditor(SEDAMetadata metadata, SED * @return the SEDA object editor * @throws SEDALibException the seda lib exception */ - static public SEDAObjectEditor createSEDAObjectEditor(String metadataType, String elementName, boolean minimal, SEDAObjectEditor father) throws - SEDALibException { + public static SEDAObjectEditor createSEDAObjectEditor( + String metadataType, + String elementName, + boolean minimal, + SEDAObjectEditor father + ) throws SEDALibException { return createSEDAObjectEditor(createSEDAMetadataSample(metadataType, elementName, minimal), father); } @@ -275,21 +307,26 @@ static public SEDAObjectEditor createSEDAObjectEditor(String metadataType, Strin * @return a SEDAMetadata of same type but empty * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getEmptySameSEDAMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { + public static SEDAMetadata getEmptySameSEDAMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { Constructor cons; try { if (sedaMetadata.getClass().getName().contains("namedtype")) { cons = sedaMetadata.getClass().getConstructor(String.class); sedaMetadata = (SEDAMetadata) cons.newInstance(sedaMetadata.getXmlElementName()); - } - else { + } else { cons = sedaMetadata.getClass().getConstructor(); sedaMetadata = (SEDAMetadata) cons.newInstance(); } } catch (NoSuchMethodException | IllegalAccessException | InstantiationException e) { - throw new SEDALibException("Pas de constructeur vide pour la métadonnée de type [" + sedaMetadata.getClass() + "]", e); + throw new SEDALibException( + "Pas de constructeur vide pour la métadonnée de type [" + sedaMetadata.getClass() + "]", + e + ); } catch (InvocationTargetException e) { - throw new SEDALibException("Erreur durant la création de la métadonnée vide de type [" + sedaMetadata.getClass() + "]", e.getTargetException()); + throw new SEDALibException( + "Erreur durant la création de la métadonnée vide de type [" + sedaMetadata.getClass() + "]", + e.getTargetException() + ); } return sedaMetadata; } @@ -302,7 +339,7 @@ static public SEDAMetadata getEmptySameSEDAMetadata(SEDAMetadata sedaMetadata) t * @return the SEDA metadata sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { throw new SEDALibException("Métadonnée non implémentée pour [" + elementName + "]"); } @@ -312,7 +349,7 @@ static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean min * @param sedaMetadata the SEDA metadata * @return the SEDA metadata information */ - static public String getSEDAMetadataInformation(SEDAMetadata sedaMetadata) { + public static String getSEDAMetadataInformation(SEDAMetadata sedaMetadata) { return SEDAObjectEditorConstants.sedaMetadataInformationMap.get(sedaMetadata.getXmlElementName()); } @@ -337,10 +374,9 @@ public SEDAObjectEditor(Object editedObject, SEDAObjectEditor father) { * * @return the name string */ - public String getTag(){ + public String getTag() { // standard case made default - if (editedObject instanceof SEDAMetadata) - return ((SEDAMetadata) editedObject).getXmlElementName(); + if (editedObject instanceof SEDAMetadata) return ((SEDAMetadata) editedObject).getXmlElementName(); return ""; } @@ -349,7 +385,7 @@ public String getTag(){ * * @return the name string */ - public String getName(){ + public String getName() { return translateTag(getTag()); } @@ -359,7 +395,7 @@ public String getName(){ * @return the edited object * @throws SEDALibException the seda lib exception */ - abstract public Object extractEditedObject() throws SEDALibException; + public abstract Object extractEditedObject() throws SEDALibException; /** * Gets edited object summary. @@ -367,14 +403,14 @@ public String getName(){ * @return the summary string * @throws SEDALibException the seda lib exception */ - abstract public String getSummary() throws SEDALibException; + public abstract String getSummary() throws SEDALibException; /** * Create SEDA object editor panel. * * @throws SEDALibException the seda lib exception */ - abstract public void createSEDAObjectEditorPanel() throws SEDALibException; + public abstract void createSEDAObjectEditorPanel() throws SEDALibException; /** * Test if the edited object can contain multiple objects with this name. @@ -394,8 +430,7 @@ public boolean canContainsMultiple(String objectName) throws SEDALibException { * @throws SEDALibException the seda lib exception */ public SEDAObjectEditorPanel getSEDAObjectEditorPanel() throws SEDALibException { - if (sedaObjectEditorPanel == null) - createSEDAObjectEditorPanel(); + if (sedaObjectEditorPanel == null) createSEDAObjectEditorPanel(); return sedaObjectEditorPanel; } @@ -405,8 +440,7 @@ public SEDAObjectEditorPanel getSEDAObjectEditorPanel() throws SEDALibException * @return the SEDA object editor panel top parent */ public Container getSEDAObjectEditorPanelTopParent() { - if (father == null) - return sedaObjectEditorPanel.getParent(); + if (father == null) return sedaObjectEditorPanel.getParent(); return father.getSEDAObjectEditorPanelTopParent(); } @@ -434,8 +468,8 @@ public Object getEditedObject() { /** * Set the edited object. - */ + */ public void setEditedObject(Object metadata) { - this.editedObject =metadata; + this.editedObject = metadata; } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java index 694dd50a..a864ea57 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SEDAObjectEditorConstants.java @@ -45,6 +45,7 @@ import java.util.Map; public class SEDAObjectEditorConstants { + /** * The SEDAMetadata filling information map. */ @@ -65,54 +66,101 @@ public class SEDAObjectEditorConstants { */ public static final Map translateMap; - static { sedaMetadataInformationMap = new HashMap<>(); - sedaMetadataInformationMap.put("DateTimeType", "Date ou Date/Temps au format ISO8601\n YYYY-MM-DD[Timezone ou Z]" + - " ou YYYY-MM-DD'T'HH:MM:SS[Timezone ou Z]"); + sedaMetadataInformationMap.put( + "DateTimeType", + "Date ou Date/Temps au format ISO8601\n YYYY-MM-DD[Timezone ou Z]" + + " ou YYYY-MM-DD'T'HH:MM:SS[Timezone ou Z]" + ); sedaMetadataInformationMap.put("DateType", "Date\n YYYY-MM-DD"); sedaMetadataInformationMap.put("AnyXMLType", "Bloc XML de structure non connue par ReSIP"); sedaMetadataInformationMap.put("AgentType", "Metadonnée de type agent"); sedaMetadataInformationMap.put("AgencyType", "Metadonnée de type agence"); sedaMetadataInformationMap.put("PlaceType", "Metadonnée de type localisation"); sedaMetadataInformationMap.put("StringType", "Metadonnée de type chaîne de caractères"); - sedaMetadataInformationMap.put("DescriptionLevel", "Metadonnée de type code de niveau de description, fait partie des valeurs: " + - "Fonds, Subfonds, Class, Collection, Series, Subseries, RecordGrp, SubGrp, File, Item, OtherLevel"); - sedaMetadataInformationMap.put("KeywordType", "Metadonnée de type code de mot-clef, fait partie des valeurs: " + - "corpname, famname, geogname, name, occupation, persname, subject, genreform, function"); + sedaMetadataInformationMap.put( + "DescriptionLevel", + "Metadonnée de type code de niveau de description, fait partie des valeurs: " + + "Fonds, Subfonds, Class, Collection, Series, Subseries, RecordGrp, SubGrp, File, Item, OtherLevel" + ); + sedaMetadataInformationMap.put( + "KeywordType", + "Metadonnée de type code de mot-clef, fait partie des valeurs: " + + "corpname, famname, geogname, name, occupation, persname, subject, genreform, function" + ); sedaMetadataInformationMap.put("IntegerType", "Metadonnée de type entier long"); sedaMetadataInformationMap.put("SIPInternalIDType", "Metadonnée de type ID de référence interne au SIP"); - sedaMetadataInformationMap.put("DataObjectOrArchiveUnitReferenceType", "Metadonnée de type ID de référence ArchiveUnit ou DataObject interne au SIP ou externe "); - sedaMetadataInformationMap.put("DataObjectReference", "Metadonnée de type ID de référence DataObject interne au SIP"); + sedaMetadataInformationMap.put( + "DataObjectOrArchiveUnitReferenceType", + "Metadonnée de type ID de référence ArchiveUnit ou DataObject interne au SIP ou externe " + ); + sedaMetadataInformationMap.put( + "DataObjectReference", + "Metadonnée de type ID de référence DataObject interne au SIP" + ); sedaMetadataInformationMap.put("ReferencedObject", "Metadonnée de type référence à un objet signé"); - sedaMetadataInformationMap.put("TextType", "Métadonnée de type chaîne de caractères. Il peut y avoir plusieurs occurrences " + - "de ce champ en plusieurs langues et il faut dans ce cas spécifier la langue dans un attribut xml. " + - "Par exemple pour définir la langue du texte comme anglaise on mettra l'attribut xml:lang=\"en\""); - sedaMetadataInformationMap.put("RelatedObjectReference", "Metadonnée de type relation ArchiveUnit ou DataObject externe ou interne au SIP"); + sedaMetadataInformationMap.put( + "TextType", + "Métadonnée de type chaîne de caractères. Il peut y avoir plusieurs occurrences " + + "de ce champ en plusieurs langues et il faut dans ce cas spécifier la langue dans un attribut xml. " + + "Par exemple pour définir la langue du texte comme anglaise on mettra l'attribut xml:lang=\"en\"" + ); + sedaMetadataInformationMap.put( + "RelatedObjectReference", + "Metadonnée de type relation ArchiveUnit ou DataObject externe ou interne au SIP" + ); sedaMetadataInformationMap.put("DigestType", "Metadonnée de type hachage avec un attribut d'algorithme"); sedaMetadataInformationMap.put("ArchiveUnitProfile", "Identifiant du profil d'unité archivistique"); - sedaMetadataInformationMap.put("Coverage", "Métadonnées de couverture spatiale, temporelle ou juridictionnelle"); - sedaMetadataInformationMap.put("CustodialHistory", "Métadonnées indiquant les changements successifs de propriété, " + - "de responsabilité et de conservation avant leur entrée dans le lieu de conservation"); - sedaMetadataInformationMap.put("Gps", "Métadonnées de coordonnées gps complétées ou vérifiées par un utilisateur"); - sedaMetadataInformationMap.put("Keyword", "Métadonnées de mots-clef avec contexte inspiré du SEDA 1.0. KeywordType " + - "doit faire partie des valeurs: corpname, famname, geogname, name, occupation, persname, subject, genreform, function"); + sedaMetadataInformationMap.put( + "Coverage", + "Métadonnées de couverture spatiale, temporelle ou juridictionnelle" + ); + sedaMetadataInformationMap.put( + "CustodialHistory", + "Métadonnées indiquant les changements successifs de propriété, " + + "de responsabilité et de conservation avant leur entrée dans le lieu de conservation" + ); + sedaMetadataInformationMap.put( + "Gps", + "Métadonnées de coordonnées gps complétées ou vérifiées par un utilisateur" + ); + sedaMetadataInformationMap.put( + "Keyword", + "Métadonnées de mots-clef avec contexte inspiré du SEDA 1.0. KeywordType " + + "doit faire partie des valeurs: corpname, famname, geogname, name, occupation, persname, subject, genreform, function" + ); sedaMetadataInformationMap.put("Signer", "Métadonnées d'un signataire de la transaction ou de l'objet"); sedaMetadataInformationMap.put("Validator", "Métadonnées du validateur de la signature"); sedaMetadataInformationMap.put("Signature", "Ensemble des métadonnées relatives à la signature."); sedaMetadataInformationMap.put("AccessRule", "Règle de communicabilité"); - sedaMetadataInformationMap.put("AppraisalRule", "Règle de durée d’utilité administrative (FinalAction possible Keep ou Destroy)"); - sedaMetadataInformationMap.put("ClassificationRule", "Règle de classification\n ClassificationLevel et ClassificationOwner obligatoires"); + sedaMetadataInformationMap.put( + "AppraisalRule", + "Règle de durée d’utilité administrative (FinalAction possible Keep ou Destroy)" + ); + sedaMetadataInformationMap.put( + "ClassificationRule", + "Règle de classification\n ClassificationLevel et ClassificationOwner obligatoires" + ); sedaMetadataInformationMap.put("DisseminationRule", "Règle de diffusion"); sedaMetadataInformationMap.put("ReuseRule", "Règle de réutilisation"); - sedaMetadataInformationMap.put("StorageRule", "Règle de durée d’utilité courante (FinalAction possible RestrictAccess,Transfer ou Copy)"); + sedaMetadataInformationMap.put( + "StorageRule", + "Règle de durée d’utilité courante (FinalAction possible RestrictAccess,Transfer ou Copy)" + ); sedaMetadataInformationMap.put("Event", "Evènement (EventDateTime obligatoire)"); // Seda 2.3 - sedaMetadataInformationMap.put("SigningRoleEditor", "Rôle de l'unité d'archives dans un contexte de signature. Quatre rôles (étiquettes) ont été" + - " identifiés : document signé, signature, horodatage et preuves complémentaires"); - sedaMetadataInformationMap.put("DetachedSigningRole", "Référence aux rôles des unités d'archives encapsulées sous la racine contenant le document signé"); - - minimalTagList=new ArrayList<>(); + sedaMetadataInformationMap.put( + "SigningRoleEditor", + "Rôle de l'unité d'archives dans un contexte de signature. Quatre rôles (étiquettes) ont été" + + " identifiés : document signé, signature, horodatage et preuves complémentaires" + ); + sedaMetadataInformationMap.put( + "DetachedSigningRole", + "Référence aux rôles des unités d'archives encapsulées sous la racine contenant le document signé" + ); + + minimalTagList = new ArrayList<>(); minimalTagList.add("DescriptionLevel"); minimalTagList.add("Title"); minimalTagList.add("Description"); @@ -161,8 +209,7 @@ public class SEDAObjectEditorConstants { minimalTagList.add("PersistentIdentifierContent"); minimalTagList.add("SigningRole"); - - largeAreaTagList=new ArrayList<>(); + largeAreaTagList = new ArrayList<>(); largeAreaTagList.add("Address"); largeAreaTagList.add("CustodialHistoryItem"); largeAreaTagList.add("Description"); @@ -421,9 +468,8 @@ public class SEDAObjectEditorConstants { translateMap.put("DataObjectGroup", "Groupe d'objets"); translateMap.put("DataObject", "Objet numérique ou physique"); - //Others - translateMap.put("Unknown","Non défini"); + translateMap.put("Unknown", "Non défini"); } private SEDAObjectEditorConstants() { @@ -438,30 +484,28 @@ private SEDAObjectEditorConstants() { */ public static String translateTag(String tag) { String result = SEDAObjectEditorConstants.translateMap.get(tag); - if (result == null) - return tag; + if (result == null) return tag; return result; } - private static int labelWidth=0; + private static int labelWidth = 0; /** * Compute max label width taking into account all object translations. * * @return the int */ - public static int computeLabelWidth(){ - if (labelWidth!=0) - return labelWidth; + public static int computeLabelWidth() { + if (labelWidth != 0) return labelWidth; - double result=0; + double result = 0; AffineTransform affinetransform = new AffineTransform(); - FontRenderContext frc = new FontRenderContext(affinetransform,true,true); - for (Map.Entrye: SEDAObjectEditorConstants.translateMap.entrySet()){ - double width= SEDAObjectEditor.LABEL_FONT.getStringBounds(e.getValue(),frc).getWidth(); - result=Math.max(result,width); + FontRenderContext frc = new FontRenderContext(affinetransform, true, true); + for (Map.Entry e : SEDAObjectEditorConstants.translateMap.entrySet()) { + double width = SEDAObjectEditor.LABEL_FONT.getStringBounds(e.getValue(), frc).getWidth(); + result = Math.max(result, width); } - labelWidth=(int)(result+31.99); + labelWidth = (int) (result + 31.99); return labelWidth; } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java index f1e91383..7b1f0c24 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/SIPInternalIDTypeEditor.java @@ -64,8 +64,9 @@ public class SIPInternalIDTypeEditor extends SEDAObjectEditor { */ public SIPInternalIDTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof SIPInternalIDType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof SIPInternalIDType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private SIPInternalIDType getSIPInternalIDTypeMetadata() { @@ -80,11 +81,9 @@ private SIPInternalIDType getSIPInternalIDTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new SIPInternalIDType(elementName, ""); - else - return new SIPInternalIDType(elementName, "ID11"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new SIPInternalIDType(elementName, ""); + else return new SIPInternalIDType(elementName, "ID11"); } @Override @@ -102,7 +101,7 @@ public String getSummary() throws SEDALibException { public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -117,7 +116,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java index 1b1eb98f..4e62f3d4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StringTypeEditor.java @@ -68,8 +68,9 @@ public class StringTypeEditor extends SEDAObjectEditor { */ public StringTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof StringType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof StringType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } private StringType getStringTypeMetadata() { @@ -84,35 +85,29 @@ private StringType getStringTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new StringType(elementName, ""); - else - return new StringType(elementName, "Text"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new StringType(elementName, ""); + else return new StringType(elementName, "Text"); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueTextField!=null) - getStringTypeMetadata().setValue(valueTextField.getText()); - else - getStringTypeMetadata().setValue(valueTextArea.getText()); + if (valueTextField != null) getStringTypeMetadata().setValue(valueTextField.getText()); + else getStringTypeMetadata().setValue(valueTextArea.getText()); return getStringTypeMetadata(); } @Override public String getSummary() throws SEDALibException { - if (valueTextField!=null) - return valueTextField.getText(); - else - return valueTextArea.getText(); + if (valueTextField != null) return valueTextField.getText(); + else return valueTextArea.getText(); } @Override public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -127,11 +122,11 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; - gbl.rowWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; + gbl.rowWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); - if (SEDAObjectEditorConstants.largeAreaTagList.contains(getTag())){ + if (SEDAObjectEditorConstants.largeAreaTagList.contains(getTag())) { valueTextArea = new AutomaticGrowingTextArea(6); valueTextArea.setText(getStringTypeMetadata().getValue()); valueTextArea.setCaretPosition(0); @@ -144,7 +139,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 0; gbc.gridy = 0; editPanel.add(valueTextArea.getScrollPane(), gbc); - JButton editButton=new JButton(); + JButton editButton = new JButton(); editButton.setIcon(new ImageIcon(getClass().getResource("/icon/text.png"))); editButton.setToolTipText("Ouvrir pour édition..."); editButton.setText(""); @@ -161,8 +156,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 1; gbc.gridy = 0; editPanel.add(editButton, gbc); - } - else { + } else { valueTextField = new JTextField(); valueTextField.setText(getStringTypeMetadata().getValue()); valueTextField.setCaretPosition(0); @@ -178,12 +172,14 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); } - private void editButton() - { - BigTextEditDialog bigTextEditDialog = new BigTextEditDialog(ResipGraphicApp.getTheWindow(), valueTextArea.getText(), getName()); + private void editButton() { + BigTextEditDialog bigTextEditDialog = new BigTextEditDialog( + ResipGraphicApp.getTheWindow(), + valueTextArea.getText(), + getName() + ); bigTextEditDialog.setVisible(true); - if (bigTextEditDialog.getReturnValue()) - valueTextArea.setText(bigTextEditDialog.getResult()); + if (bigTextEditDialog.getReturnValue()) valueTextArea.setText(bigTextEditDialog.getResult()); } /** @@ -191,12 +187,11 @@ private void editButton() * * @param value the value */ - public void setValue(String value){ - if (valueTextField!=null) { + public void setValue(String value) { + if (valueTextField != null) { valueTextField.setText(value); valueTextField.setCaretPosition(0); - } - else { + } else { valueTextArea.setText(value); valueTextArea.setCaretPosition(0); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java index e19d009c..df2b93cd 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/TextTypeEditor.java @@ -39,8 +39,8 @@ import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; import fr.gouv.vitam.tools.resip.frame.BigTextEditDialog; -import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.SEDAObjectEditorSimplePanel; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.AutomaticGrowingTextArea; +import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.SEDAObjectEditorSimplePanel; import fr.gouv.vitam.tools.sedalib.metadata.SEDAMetadata; import fr.gouv.vitam.tools.sedalib.metadata.namedtype.TextType; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; @@ -71,7 +71,7 @@ public class TextTypeEditor extends SEDAObjectEditor { /** * The graphic elements */ - private JLabel beforeLabel,innerLabel; + private JLabel beforeLabel, innerLabel; private JButton langButton; private GridBagLayout labelGBL; private int algorithmWidth; @@ -85,8 +85,7 @@ public class TextTypeEditor extends SEDAObjectEditor { */ public TextTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof TextType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof TextType)) throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); } private TextType getTextTypeMetadata() { @@ -101,19 +100,15 @@ private TextType getTextTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new TextType(elementName, ""); - else - return new TextType(elementName, "Text"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new TextType(elementName, ""); + else return new TextType(elementName, "Text"); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueTextField!=null) - getTextTypeMetadata().setValue(valueTextField.getText()); - else - getTextTypeMetadata().setValue(valueTextArea.getText()); + if (valueTextField != null) getTextTypeMetadata().setValue(valueTextField.getText()); + else getTextTypeMetadata().setValue(valueTextArea.getText()); String attr = attributeTextField.getText(); if (attr.isEmpty()) attr = null; getTextTypeMetadata().setLang(attr); @@ -123,14 +118,13 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { @Override public String getSummary() throws SEDALibException { String tmp; - String result=""; - if (valueTextField!=null) - tmp= valueTextField.getText(); - else - tmp= valueTextArea.getText(); - if ((attributeTextField.getText()!=null) && !attributeTextField.getText().isEmpty()) - result="("+ attributeTextField.getText()+")"; - return result+tmp; + String result = ""; + if (valueTextField != null) tmp = valueTextField.getText(); + else tmp = valueTextArea.getText(); + if ((attributeTextField.getText() != null) && !attributeTextField.getText().isEmpty()) result = "(" + + attributeTextField.getText() + + ")"; + return result + tmp; } @Override @@ -139,12 +133,12 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { GridBagLayout gbl; AffineTransform affinetransform = new AffineTransform(); - FontRenderContext frc = new FontRenderContext(affinetransform,true,true); - algorithmWidth=(int) SEDAObjectEditor.LABEL_FONT.getStringBounds("ww",frc).getWidth(); + FontRenderContext frc = new FontRenderContext(affinetransform, true, true); + algorithmWidth = (int) SEDAObjectEditor.LABEL_FONT.getStringBounds("ww", frc).getWidth(); - labelGBL= new GridBagLayout(); - labelGBL.columnWidths = new int[]{0, 0, 0}; - labelGBL.columnWeights = new double[]{1.0, 0.0, 0.0}; + labelGBL = new GridBagLayout(); + labelGBL.columnWidths = new int[] { 0, 0, 0 }; + labelGBL.columnWeights = new double[] { 1.0, 0.0, 0.0 }; labelPanel.setLayout(labelGBL); beforeLabel = new JLabel(getName() + (getTextTypeMetadata().getLang() == null ? "" : "(")); @@ -182,12 +176,11 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { if (getTextTypeMetadata().getLang() == null) { langButton.setVisible(true); attributeTextField.setVisible(false); - labelGBL.columnWidths = new int[]{0, 0, 0}; - } - else{ + labelGBL.columnWidths = new int[] { 0, 0, 0 }; + } else { langButton.setVisible(false); attributeTextField.setVisible(true); - labelGBL.columnWidths = new int[]{0,algorithmWidth, 0}; + labelGBL.columnWidths = new int[] { 0, algorithmWidth, 0 }; } innerLabel = new JLabel((getTextTypeMetadata().getLang() == null ? ":" : ") :")); @@ -200,13 +193,13 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridy = 0; labelPanel.add(innerLabel, gbc); - JPanel editPanel= new JPanel(); + JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0,0.0}; - gbl.rowWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0, 0.0 }; + gbl.rowWeights = new double[] { 1.0 }; editPanel.setLayout(gbl); - if (SEDAObjectEditorConstants.largeAreaTagList.contains(getTag())){ + if (SEDAObjectEditorConstants.largeAreaTagList.contains(getTag())) { valueTextArea = new AutomaticGrowingTextArea(6); valueTextArea.setText(getTextTypeMetadata().getValue()); valueTextArea.setCaretPosition(0); @@ -219,7 +212,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 0; gbc.gridy = 0; editPanel.add(valueTextArea.getScrollPane(), gbc); - JButton editButton=new JButton(); + JButton editButton = new JButton(); editButton.setIcon(new ImageIcon(getClass().getResource("/icon/text.png"))); editButton.setToolTipText("Ouvrir pour édition..."); editButton.setText(""); @@ -236,8 +229,7 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { gbc.gridx = 1; gbc.gridy = 0; editPanel.add(editButton, gbc); - } - else { + } else { valueTextField = new JTextField(); valueTextField.setText(getTextTypeMetadata().getValue()); valueTextField.setCaretPosition(0); @@ -250,24 +242,25 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { editPanel.add(valueTextField, gbc); } - this.sedaObjectEditorPanel =new SEDAObjectEditorSimplePanel(this,labelPanel,editPanel); + this.sedaObjectEditorPanel = new SEDAObjectEditorSimplePanel(this, labelPanel, editPanel); } - private void langActivate() - { + private void langActivate() { langButton.setVisible(false); attributeTextField.setVisible(true); - labelGBL.columnWidths = new int[]{0,algorithmWidth, 0}; + labelGBL.columnWidths = new int[] { 0, algorithmWidth, 0 }; beforeLabel.setText(getName() + " ("); innerLabel.setText(") :"); attributeTextField.grabFocus(); } - private void editButton() - { - BigTextEditDialog bigTextEditDialog = new BigTextEditDialog(ResipGraphicApp.getTheWindow(), valueTextArea.getText(), getName()); + private void editButton() { + BigTextEditDialog bigTextEditDialog = new BigTextEditDialog( + ResipGraphicApp.getTheWindow(), + valueTextArea.getText(), + getName() + ); bigTextEditDialog.setVisible(true); - if (bigTextEditDialog.getReturnValue()) - valueTextArea.setText(bigTextEditDialog.getResult()); + if (bigTextEditDialog.getReturnValue()) valueTextArea.setText(bigTextEditDialog.getResult()); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java index 6ce9972c..bb2cb6bb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/WeightEditor.java @@ -67,8 +67,7 @@ public class WeightEditor extends SEDAObjectEditor { */ public WeightEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof Weight)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof Weight)) throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); } private Weight getWeightMetadata() { @@ -83,33 +82,32 @@ private Weight getWeightMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - static public SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { - if (minimal) - return new Weight(); - else - return new Weight(42.42, "gram"); + public static SEDAMetadata getSEDAMetadataSample(String elementName, boolean minimal) throws SEDALibException { + if (minimal) return new Weight(); + else return new Weight(42.42, "gram"); } @Override public SEDAMetadata extractEditedObject() throws SEDALibException { - if (valueTextField.getText().isEmpty()) - getWeightMetadata().setValue(null); - else - getWeightMetadata().setValue(Double.parseDouble(valueTextField.getText())); + if (valueTextField.getText().isEmpty()) getWeightMetadata().setValue(null); + else getWeightMetadata().setValue(Double.parseDouble(valueTextField.getText())); getWeightMetadata().setUnit((String) (unitComboBox.getSelectedItem())); return getWeightMetadata(); } @Override public String getSummary() throws SEDALibException { - return (valueTextField.getText() == null ? "" : valueTextField.getText() + " ") + (unitComboBox.getSelectedItem()==null?"":unitComboBox.getSelectedItem()); + return ( + (valueTextField.getText() == null ? "" : valueTextField.getText() + " ") + + (unitComboBox.getSelectedItem() == null ? "" : unitComboBox.getSelectedItem()) + ); } @Override public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel labelPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; labelPanel.setLayout(gbl); JLabel label = new JLabel(getName() + " :"); @@ -124,14 +122,16 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { JPanel editPanel = new JPanel(); gbl = new GridBagLayout(); - gbl.columnWidths = new int[]{100, 0}; - gbl.columnWeights = new double[]{0.0, 1.0}; + gbl.columnWidths = new int[] { 100, 0 }; + gbl.columnWeights = new double[] { 0.0, 1.0 }; editPanel.setLayout(gbl); valueTextField = new JTextField(); DocumentFilter filter = new DoubleFilter(); ((AbstractDocument) valueTextField.getDocument()).setDocumentFilter(filter); - valueTextField.setText((getWeightMetadata().getValue() == null ? "" : Double.toString(getWeightMetadata().getValue()))); + valueTextField.setText( + (getWeightMetadata().getValue() == null ? "" : Double.toString(getWeightMetadata().getValue())) + ); valueTextField.setFont(SEDAObjectEditor.EDIT_FONT); gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java index 66d1c9fc..8757bb1b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredArchiveUnitEditorPanel.java @@ -77,15 +77,14 @@ public StructuredArchiveUnitEditorPanel() { this.archiveUnitEditor = new ArchiveUnitEditor(null, null); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{0.0, 1.0, 0.0}; - gbl.rowWeights = new double[]{1.0, 0.0}; + gbl.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gbl.rowWeights = new double[] { 1.0, 0.0 }; setLayout(gbl); SEDAObjectEditorPanel mep = null; try { mep = archiveUnitEditor.getSEDAObjectEditorPanel(); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} scrollPane = new JScrollPane(mep); gbc = new GridBagConstraints(); @@ -109,7 +108,11 @@ public StructuredArchiveUnitEditorPanel() { gbc.gridwidth = 3; add(warningPane, gbc); - JLabel warningLabel = new JLabel("", new ImageIcon(getClass().getResource("/icon/large-dialog-warning.png")), SwingConstants.CENTER); + JLabel warningLabel = new JLabel( + "", + new ImageIcon(getClass().getResource("/icon/large-dialog-warning.png")), + SwingConstants.CENTER + ); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_START; gbc.insets = new Insets(5, 5, 5, 5); @@ -129,7 +132,7 @@ public StructuredArchiveUnitEditorPanel() { gbc.gridy = 0; warningPane.add(warningText, gbc); - revertButton = new JButton("Recharger "+translateTag("ArchiveUnit").toLowerCase()); + revertButton = new JButton("Recharger " + translateTag("ArchiveUnit").toLowerCase()); revertButton.setEnabled(false); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; @@ -141,7 +144,7 @@ public StructuredArchiveUnitEditorPanel() { }); add(revertButton, gbc); - saveButton = new JButton("Sauver "+translateTag("ArchiveUnit").toLowerCase()); + saveButton = new JButton("Sauver " + translateTag("ArchiveUnit").toLowerCase()); saveButton.setEnabled(false); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; @@ -156,9 +159,8 @@ public StructuredArchiveUnitEditorPanel() { private void revertButton(ActionEvent event) { try { - editArchiveUnit((ArchiveUnit)archiveUnitEditor.getEditedObject()); - } catch (SEDALibException ignored) { - } + editArchiveUnit((ArchiveUnit) archiveUnitEditor.getEditedObject()); + } catch (SEDALibException ignored) {} } private void saveButton(ActionEvent event) { @@ -166,8 +168,7 @@ private void saveButton(ActionEvent event) { archiveUnitEditor.extractEditedObject(); ResipGraphicApp.getTheWindow().treePane.resetDisplayedTreeNodeTitle(); ResipGraphicApp.getTheApp().setModifiedContext(true); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } @Override @@ -185,9 +186,14 @@ public void editArchiveUnit(ArchiveUnit archiveUnit) throws SEDALibException { archiveUnit.getArchiveUnitProfile(); } catch (SEDALibException e) { String title = SEDAXMLEventReader.extractNamedElement("Title", archiveUnit.getContentXmlData()); - warningText.setText(translateTag("ArchiveUnit") + " - " + (title != null ? title + " - " : "") + archiveUnit.getInDataObjectPackageId() - + " a un problème de construction qui empêche de l'éditer de manière structurée.\n" - + SEDALibProgressLogger.getMessagesStackString(e)); + warningText.setText( + translateTag("ArchiveUnit") + + " - " + + (title != null ? title + " - " : "") + + archiveUnit.getInDataObjectPackageId() + + " a un problème de construction qui empêche de l'éditer de manière structurée.\n" + + SEDALibProgressLogger.getMessagesStackString(e) + ); scrollPane.setVisible(false); warningPane.setVisible(true); return; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java index e1461fcf..ba06513d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/StructuredDataObjectGroupEditorPanel.java @@ -84,15 +84,14 @@ public StructuredDataObjectGroupEditorPanel() { this.editedArchiveUnit = null; gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{0.0, 1.0, 0.0}; - gbl.rowWeights = new double[]{1.0, 0.0}; + gbl.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gbl.rowWeights = new double[] { 1.0, 0.0 }; setLayout(gbl); SEDAObjectEditorPanel mep = null; try { mep = dataObjectGroupEditor.getSEDAObjectEditorPanel(); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} scrollPane = new JScrollPane(mep); gbc = new GridBagConstraints(); @@ -116,7 +115,9 @@ public StructuredDataObjectGroupEditorPanel() { gbc.gridwidth = 3; add(addPane, gbc); - JLabel addText = new JLabel(translateTag("ArchiveUnit") + " sans " + translateTag("DataObjectGroup").toLowerCase()); + JLabel addText = new JLabel( + translateTag("ArchiveUnit") + " sans " + translateTag("DataObjectGroup").toLowerCase() + ); addText.setFont(SEDAObjectEditor.LABEL_FONT); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.LINE_START; @@ -136,7 +137,7 @@ public StructuredDataObjectGroupEditorPanel() { }); addPane.add(addButton, gbc); - revertButton = new JButton("Recharger "+translateTag("DataObjectGroup").toLowerCase()); + revertButton = new JButton("Recharger " + translateTag("DataObjectGroup").toLowerCase()); revertButton.setEnabled(false); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; @@ -148,7 +149,7 @@ public StructuredDataObjectGroupEditorPanel() { }); add(revertButton, gbc); - saveButton = new JButton("Sauver "+translateTag("DataObjectGroup").toLowerCase()); + saveButton = new JButton("Sauver " + translateTag("DataObjectGroup").toLowerCase()); saveButton.setEnabled(false); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; @@ -164,22 +165,31 @@ public StructuredDataObjectGroupEditorPanel() { private void revertButton(ActionEvent event) { try { editDataObjectGroup(editedArchiveUnit); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } private void saveButton(ActionEvent event) { try { // when a new DataObjectGroup has been created - if ((dataObjectGroupEditor.getEditedObject()!=null) && (((DataObjectGroup)dataObjectGroupEditor.getEditedObject()).getInDataObjectPackageId() == null)) { - editedDataObjectGroup = (DataObjectGroup)dataObjectGroupEditor.getEditedObject(); - editedArchiveUnit.getDataObjectPackage().addDataObjectGroup((DataObjectGroup)dataObjectGroupEditor.getEditedObject()); - editedArchiveUnit.addDataObjectById(((DataObjectGroup)dataObjectGroupEditor.getEditedObject()).getInDataObjectPackageId()); + if ( + (dataObjectGroupEditor.getEditedObject() != null) && + (((DataObjectGroup) dataObjectGroupEditor.getEditedObject()).getInDataObjectPackageId() == null) + ) { + editedDataObjectGroup = (DataObjectGroup) dataObjectGroupEditor.getEditedObject(); + editedArchiveUnit + .getDataObjectPackage() + .addDataObjectGroup((DataObjectGroup) dataObjectGroupEditor.getEditedObject()); + editedArchiveUnit.addDataObjectById( + ((DataObjectGroup) dataObjectGroupEditor.getEditedObject()).getInDataObjectPackageId() + ); ResipGraphicApp.getTheWindow().treePane.addDataObjectGroupToDisplayedTreeNode(editedDataObjectGroup); ((CompositeEditor) dataObjectGroupEditor).refreshEditedObjectLabel(); } DataObjectGroup dog = dataObjectGroupEditor.extractEditedObject(); - if ((dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0) && (dog.logBook == null)) { + if ( + (dog.getBinaryDataObjectList().size() + dog.getPhysicalDataObjectList().size() == 0) && + (dog.logBook == null) + ) { ArchiveUnit memoryArchiveUnit = editedArchiveUnit; editedArchiveUnit.removeEmptyDataObjectGroup(); dataObjectGroupEditor.editDataObjectGroup(null); @@ -216,14 +226,14 @@ private void addDataObjectGroupButton(ActionEvent event) { @Override public void editDataObjectGroup(ArchiveUnit archiveUnit) throws SEDALibException { this.editedArchiveUnit = archiveUnit; - if (editedArchiveUnit==null){ + if (editedArchiveUnit == null) { dataObjectGroupEditor.editDataObjectGroup(null); scrollPane.setVisible(true); saveButton.setEnabled(false); revertButton.setEnabled(false); revalidate(); repaint(); - } else if (editedArchiveUnit.getTheDataObjectGroup() == null) { + } else if (editedArchiveUnit.getTheDataObjectGroup() == null) { dataObjectGroupEditor.editDataObjectGroup(null); scrollPane.setVisible(false); addPane.setVisible(true); @@ -246,9 +256,9 @@ public DataObjectGroup extractDataObjectGroup() throws SEDALibException { } @Override - public void selectDataObject(DataObject dataObject) throws SEDALibException{ - for (SEDAObjectEditor soe:dataObjectGroupEditor.objectEditorList){ - ((CompositeEditor)soe).doExpand((soe.getEditedObject()==dataObject),false); + public void selectDataObject(DataObject dataObject) throws SEDALibException { + for (SEDAObjectEditor soe : dataObjectGroupEditor.objectEditorList) { + ((CompositeEditor) soe).doExpand((soe.getEditedObject() == dataObject), false); } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java index 07c16f81..5d086dc4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/TreeDataObjectPackageEditorPanel.java @@ -64,6 +64,7 @@ import static fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditorConstants.translateTag; public class TreeDataObjectPackageEditorPanel extends JPanel { + /** * The editedObject. */ @@ -86,10 +87,10 @@ public TreeDataObjectPackageEditorPanel() { GridBagConstraints gbc; gbl = new GridBagLayout(); - gbl.rowHeights = new int[]{0, 200, 0}; - gbl.rowWeights = new double[]{0.0, 1.0, 0.0}; - gbl.columnWidths = new int[]{75,75}; - gbl.columnWeights = new double[]{1.0,1.0}; + gbl.rowHeights = new int[] { 0, 200, 0 }; + gbl.rowWeights = new double[] { 0.0, 1.0, 0.0 }; + gbl.columnWidths = new int[] { 75, 75 }; + gbl.columnWeights = new double[] { 1.0, 1.0 }; setLayout(gbl); dataObjectPackageTreeLabel = new JLabel("Arbre du SIP"); @@ -124,7 +125,7 @@ public TreeDataObjectPackageEditorPanel() { gbc.anchor = GridBagConstraints.LINE_START; gbc.gridx = 0; gbc.gridy = 2; - add(longDataObjectPackageTreeItemNameCheckBox,gbc); + add(longDataObjectPackageTreeItemNameCheckBox, gbc); JPanel expandReducePanel = new JPanel(); expandReducePanel.setLayout(new GridBagLayout()); @@ -184,35 +185,42 @@ private void checkBoxLongDataObjectPackageTreeItemName(ActionEvent e) { private void buttonExpandReduceTree(boolean state) { TreePath[] selection; if (editedDataObjectPackage != null) { - if (dataObjectPackageTreeViewer.getSelectionPaths() != null) - selection = dataObjectPackageTreeViewer.getSelectionPaths(); + if (dataObjectPackageTreeViewer.getSelectionPaths() != null) selection = + dataObjectPackageTreeViewer.getSelectionPaths(); else { - DataObjectPackageTreeNode ghostRootNode = (DataObjectPackageTreeNode) (dataObjectPackageTreeViewer.getModel().getRoot()); + DataObjectPackageTreeNode ghostRootNode = (DataObjectPackageTreeNode) (dataObjectPackageTreeViewer + .getModel() + .getRoot()); if (ghostRootNode != null) { selection = new TreePath[1]; selection[0] = new TreePath(ghostRootNode); - } else - return; + } else return; } int nb = 0; - for (TreePath path : selection) - nb += ((DataObjectPackageTreeNode) (path.getLastPathComponent())).getAuRecursivCount() - + ((DataObjectPackageTreeNode) (path.getLastPathComponent())).getOgRecursivCount(); - - if ((nb > 10000) && - (UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Attention, quand il y a plus de 10000 ArchiveUnit et DataObjectGroup sélectionnés (en l'occurrence " + nb + "), " + - "l'ouverture ou la fermeture de tous ces noeuds de l'arbre peut prendre beaucoup de temps.\n" - + "Voulez-vous continuer? ", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - "Si vous préférez éviter, utilisez l'expansion/réduction sur chaque noeud dans l'arbre en " + - "cliquant sur le petit signe + ou - au début des lignes, ou en double cliquant sur l'ArchiveUnit.") != OK_DIALOG)) - return; + for (TreePath path : selection) nb += + ((DataObjectPackageTreeNode) (path.getLastPathComponent())).getAuRecursivCount() + + ((DataObjectPackageTreeNode) (path.getLastPathComponent())).getOgRecursivCount(); + + if ( + (nb > 10000) && + (UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Attention, quand il y a plus de 10000 ArchiveUnit et DataObjectGroup sélectionnés (en l'occurrence " + + nb + + "), " + + "l'ouverture ou la fermeture de tous ces noeuds de l'arbre peut prendre beaucoup de temps.\n" + + "Voulez-vous continuer? ", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + "Si vous préférez éviter, utilisez l'expansion/réduction sur chaque noeud dans l'arbre en " + + "cliquant sur le petit signe + ou - au début des lignes, ou en double cliquant sur l'ArchiveUnit." + ) != + OK_DIALOG) + ) return; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - for (TreePath path : selection) - dataObjectPackageTreeViewer.setPathExpansionState(path, state); + for (TreePath path : selection) dataObjectPackageTreeViewer.setPathExpansionState(path, state); setCursor(Cursor.getDefaultCursor()); } } @@ -230,8 +238,7 @@ private void buttonOpenDataObjectPackageItemDirectory() { path = ((DataObjectPackageIdElement) stn.getDataObject()).getOnDiskPath(); } } - if (path != null) - Desktop.getDesktop().open(path.toFile()); + if (path != null) Desktop.getDesktop().open(path.toFile()); } catch (IOException e) { // too bad } @@ -239,23 +246,22 @@ private void buttonOpenDataObjectPackageItemDirectory() { // tree methods - - private void allChildNodesChanged(DataObjectPackageTreeNode attn) { + private void allChildNodesChanged(DataObjectPackageTreeNode attn) { int[] allChilds = new int[attn.getChildCount()]; for (int i = 0; i < attn.getChildCount(); i++) { allChilds[i] = i; allChildNodesChanged((DataObjectPackageTreeNode) attn.getChildAt(i)); } - ((DataObjectPackageTreeModel)dataObjectPackageTreeViewer.getModel()).nodesChanged(attn, allChilds); + ((DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel()).nodesChanged(attn, allChilds); } /** * All tree changed. */ public void allTreeChanged() { - DataObjectPackageTreeNode root = (DataObjectPackageTreeNode) ((DataObjectPackageTreeModel)dataObjectPackageTreeViewer.getModel()).getRoot(); - if (root != null) - allChildNodesChanged(root); + DataObjectPackageTreeNode root = + (DataObjectPackageTreeNode) ((DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel()).getRoot(); + if (root != null) allChildNodesChanged(root); } /** @@ -269,7 +275,10 @@ public void displayedTreeNodeChanged() { * Add DataObjectGroup to displayed tree node. */ public void addDataObjectGroupToDisplayedTreeNode(DataObjectGroup dataObjectGroup) { - ((DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel()).generateDataObjectNode(dataObjectGroup, ResipGraphicApp.getTheWindow().treePane.displayedTreeNode); + ((DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel()).generateDataObjectNode( + dataObjectGroup, + ResipGraphicApp.getTheWindow().treePane.displayedTreeNode + ); displayedTreeNodeChanged(); } @@ -280,12 +289,12 @@ public void resetDisplayedTreeNodeTitle() { String title = null; try { title = displayedTreeNode.getArchiveUnit().getContent().getSimpleMetadata("Title"); - } catch (SEDALibException ignored) { - } - if (title == null) - title = SEDAXMLEventReader.extractNamedElement("Title", displayedTreeNode.getArchiveUnit().getContentXmlData()); - if (title == null) - title = translateTag("Unknown"); + } catch (SEDALibException ignored) {} + if (title == null) title = SEDAXMLEventReader.extractNamedElement( + "Title", + displayedTreeNode.getArchiveUnit().getContentXmlData() + ); + if (title == null) title = translateTag("Unknown"); displayedTreeNode.setTitle(title); displayedTreeNodeChanged(); } @@ -295,7 +304,7 @@ public void resetDisplayedTreeNodeTitle() { * * @return the data object package tree node */ - public DataObjectPackageTreeNode getDisplayedTreeNode(){ + public DataObjectPackageTreeNode getDisplayedTreeNode() { return displayedTreeNode; } @@ -306,7 +315,9 @@ public DataObjectPackageTreeNode getDisplayedTreeNode(){ * @return the data object package tree node */ public String getTreeTitle(ArchiveUnit archiveUnit) { - return ((DataObjectPackageTreeModel)dataObjectPackageTreeViewer.getModel()).findTreeNode(archiveUnit).getTitle(); + return ((DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel()).findTreeNode( + archiveUnit + ).getTitle(); } /** @@ -330,7 +341,10 @@ private String buildTreeLabel(DataObjectPackage dataObjectPackage) { return String.format( "Arbre du SIP (%d archiveUnit / %d dog / %d bdo / %d pdo)", - archiveUnitCount, dogCount, bdoCount, pdoCount + archiveUnitCount, + dogCount, + bdoCount, + pdoCount ); } @@ -342,8 +356,7 @@ public void reset() { displayedTreeNode = null; try { ResipGraphicApp.getTheWindow().auMetadataPane.editArchiveUnit(null); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } /** @@ -353,20 +366,25 @@ public void reset() { */ public void selectTreePathItem(TreePath path) { DataObjectPackageTreeNode node = (DataObjectPackageTreeNode) path.getLastPathComponent(); - if (node.getArchiveUnit() == null) - node = (DataObjectPackageTreeNode) path.getParentPath().getLastPathComponent(); + if (node.getArchiveUnit() == null) node = (DataObjectPackageTreeNode) path + .getParentPath() + .getLastPathComponent(); try { ResipGraphicApp.getTheWindow().auMetadataPane.editArchiveUnit(node.getArchiveUnit()); } catch (SEDALibException e) { - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Resip.InOut: Erreur à l'indentation de l'ArchiveUnit [" - + node.getArchiveUnit().getInDataObjectPackageId() + "]",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.InOut: Erreur à l'indentation de l'ArchiveUnit [" + + node.getArchiveUnit().getInDataObjectPackageId() + + "]", + e + ); } displayedTreeNode = node; - if (node.getArchiveUnit().getOnDiskPath() != null) - openSipItemButton.setEnabled(true); - else - openSipItemButton.setEnabled(false); + if (node.getArchiveUnit().getOnDiskPath() != null) openSipItemButton.setEnabled(true); + else openSipItemButton.setEnabled(false); } /** @@ -376,8 +394,8 @@ public void selectTreePathItem(TreePath path) { * @return the data object package tree node of the selected ArchiveUnit */ public DataObjectPackageTreeNode focusArchiveUnit(ArchiveUnit archiveUnit) { - DataObjectPackageTreeModel model=(DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); - DataObjectPackageTreeNode focusNode= model.findTreeNode(archiveUnit); + DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); + DataObjectPackageTreeNode focusNode = model.findTreeNode(archiveUnit); TreePath path = new TreePath(model.getPathToRoot(focusNode)); dataObjectPackageTreeViewer.setExpandsSelectedPaths(true); @@ -394,8 +412,8 @@ public DataObjectPackageTreeNode focusArchiveUnit(ArchiveUnit archiveUnit) { * @return the data object package tree node of the selected ArchiveUnit */ public DataObjectPackageTreeNode focusDataObjectGroup(DataObjectGroup dataObjectGroup) { - DataObjectPackageTreeModel model=(DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); - DataObjectPackageTreeNode focusNode= model.findTreeNode(dataObjectGroup); + DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); + DataObjectPackageTreeNode focusNode = model.findTreeNode(dataObjectGroup); TreePath path = new TreePath(model.getPathToRoot(focusNode)); dataObjectPackageTreeViewer.setExpandsSelectedPaths(true); @@ -413,8 +431,8 @@ public DataObjectPackageTreeNode focusDataObjectGroup(DataObjectGroup dataObject * @return the data object package tree node of the selected ArchiveUnit */ public DataObjectPackageTreeNode focusDataObject(ArchiveUnit archiveUnit, DataObject dataObject) { - DataObjectPackageTreeModel model=(DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); - DataObjectPackageTreeNode focusNode= model.findTreeNode(archiveUnit); + DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); + DataObjectPackageTreeNode focusNode = model.findTreeNode(archiveUnit); TreePath path = new TreePath(model.getPathToRoot(focusNode)); dataObjectPackageTreeViewer.setExpandsSelectedPaths(true); @@ -423,8 +441,7 @@ public DataObjectPackageTreeNode focusDataObject(ArchiveUnit archiveUnit, DataOb selectTreePathItem(path); try { ResipGraphicApp.getTheWindow().dogMetadataPane.selectDataObject(dataObject); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} return focusNode; } @@ -435,12 +452,12 @@ public DataObjectPackageTreeNode focusDataObject(ArchiveUnit archiveUnit, DataOb * * @param dataObjectPackage the data object package */ - public void editDataObjectPackage(DataObjectPackage dataObjectPackage){ + public void editDataObjectPackage(DataObjectPackage dataObjectPackage) { DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); DataObjectPackageTreeNode top; - this.editedDataObjectPackage=dataObjectPackage; - if (dataObjectPackage!=null) { + this.editedDataObjectPackage = dataObjectPackage; + if (dataObjectPackage != null) { top = model.generateDataObjectPackageNodes(dataObjectPackage); refreshTreeLabel(); } else { @@ -456,6 +473,7 @@ public void editDataObjectPackage(DataObjectPackage dataObjectPackage){ * The Sort by title tool. */ class SortByTitle implements Comparator { + DataObjectPackageTreeModel treeModel; public int compare(ArchiveUnit a, ArchiveUnit b) { @@ -474,18 +492,23 @@ public int compare(ArchiveUnit a, ArchiveUnit b) { *

    * Except order, change as little as possible graphic form, including expansion and selection. */ - public void doSortTree(){ - if (editedDataObjectPackage!=null) { + public void doSortTree() { + if (editedDataObjectPackage != null) { DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); Map expansionState = dataObjectPackageTreeViewer.getExpansionState(); TreePath selectedPath = dataObjectPackageTreeViewer.getSelectionPath(); - TreeDataObjectPackageEditorPanel.SortByTitle sortByTitle = new TreeDataObjectPackageEditorPanel.SortByTitle(model); - for (Map.Entry pair : - editedDataObjectPackage.getAuInDataObjectPackageIdMap().entrySet()) { + TreeDataObjectPackageEditorPanel.SortByTitle sortByTitle = new TreeDataObjectPackageEditorPanel.SortByTitle( + model + ); + for (Map.Entry pair : editedDataObjectPackage + .getAuInDataObjectPackageIdMap() + .entrySet()) { Collections.sort(pair.getValue().getChildrenAuList().getArchiveUnitList(), sortByTitle); } - Collections.sort(editedDataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList(), - sortByTitle); + Collections.sort( + editedDataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList(), + sortByTitle + ); model.reload(); dataObjectPackageTreeViewer.setExpansionState(expansionState); if (selectedPath != null) { @@ -503,8 +526,8 @@ public void doSortTree(){ * and drop nodes no more linked to DataObjectPackage structure. * Change as little as possible graphic form, including expansion and selection. */ - public void doRefreshTree(){ - if (editedDataObjectPackage!=null) { + public void doRefreshTree() { + if (editedDataObjectPackage != null) { DataObjectPackageTreeModel model = (DataObjectPackageTreeModel) dataObjectPackageTreeViewer.getModel(); Map expansionState = dataObjectPackageTreeViewer.getExpansionState(); TreePath selectedPath = dataObjectPackageTreeViewer.getSelectionPath(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java index b499353b..00851b0a 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLArchiveUnitEditorPanel.java @@ -60,7 +60,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -68,6 +67,7 @@ import static fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditorConstants.translateTag; public class XMLArchiveUnitEditorPanel extends JPanel implements ArchiveUnitEditorPanel { + /** * The editedObject. */ @@ -87,7 +87,7 @@ public class XMLArchiveUnitEditorPanel extends JPanel implements ArchiveUnitEdit * * @return the string [ ] */ - static public String[] getAddContentMetadataArray() { + public static String[] getAddContentMetadataArray() { List options = new ArrayList<>(); try { @@ -111,7 +111,8 @@ static public String[] getAddContentMetadataArray() { managementMetadataList.sort(String::compareTo); options.addAll(managementMetadataList); } catch (SEDALibException e) { - ResipLogger.getGlobalLogger().log(ResipLogger.GLOBAL, "Errors occurs while computing add metadata options", e); + ResipLogger.getGlobalLogger() + .log(ResipLogger.GLOBAL, "Errors occurs while computing add metadata options", e); } return options.toArray(new String[0]); @@ -123,11 +124,11 @@ static public String[] getAddContentMetadataArray() { public XMLArchiveUnitEditorPanel() { this.archiveUnit = null; GridBagLayout gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{0.0, 1.0, 0.0}; - gbl.rowWeights = new double[]{0.0, 1.0, 0.0}; + gbl.columnWeights = new double[] { 0.0, 1.0, 0.0 }; + gbl.rowWeights = new double[] { 0.0, 1.0, 0.0 }; setLayout(gbl); - globalLabel = new JLabel(translateTag("ArchiveUnit") + " - "+ translateTag("Unknown")); + globalLabel = new JLabel(translateTag("ArchiveUnit") + " - " + translateTag("Unknown")); globalLabel.setFont(SEDAObjectEditor.BOLD_LABEL_FONT); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 3; @@ -186,7 +187,6 @@ public XMLArchiveUnitEditorPanel() { gbc.gridx = 2; gbc.gridy = 2; add(choiceComboBox, gbc); - } private void editButton(ActionEvent event) { @@ -214,10 +214,16 @@ private SEDAMetadata getAddedMetadataSample(String choiceName) throws SEDALibExc } else { metadataMap = new Management().getMetadataMap(); } - if (elementName.equals("AnyOtherMetadata")) - result = SEDAObjectEditor.createSEDAMetadataSample("AnyXMLType", elementName, false); - else - result = SEDAObjectEditor.createSEDAMetadataSample(metadataMap.get(elementName).getMetadataClass().getSimpleName(), elementName, false); + if (elementName.equals("AnyOtherMetadata")) result = SEDAObjectEditor.createSEDAMetadataSample( + "AnyXMLType", + elementName, + false + ); + else result = SEDAObjectEditor.createSEDAMetadataSample( + metadataMap.get(elementName).getMetadataClass().getSimpleName(), + elementName, + false + ); } return result; } @@ -247,12 +253,15 @@ private void addButton(ActionEvent event) { ResipGraphicApp.getTheApp().setModifiedContext(true); } } catch (SEDALibException e) { - UserInteractionDialog.getUserAnswer((JFrame) (SwingUtilities.windowForComponent(this)), - "L'édition des métadonnées de l'ArchiveUnit n'a pas été possible.\n->" - + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "L'édition des métadonnées de l'ArchiveUnit n'a pas été possible.",e); + UserInteractionDialog.getUserAnswer( + (JFrame) (SwingUtilities.windowForComponent(this)), + "L'édition des métadonnées de l'ArchiveUnit n'a pas été possible.\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log(ResipLogger.ERROR, "L'édition des métadonnées de l'ArchiveUnit n'a pas été possible.", e); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java index 18967111..78b9ce48 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/highlevelcomponents/XMLDataObjectGroupEditorPanel.java @@ -62,6 +62,7 @@ import static fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditorConstants.translateTag; public class XMLDataObjectGroupEditorPanel extends JPanel implements DataObjectGroupEditorPanel { + /** * The ArchiveUnit owning the original edited DataObjectGroup */ @@ -90,8 +91,8 @@ public XMLDataObjectGroupEditorPanel() { this.displayedDataObject = null; gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; - gbl.rowWeights = new double[]{1.0}; + gbl.columnWeights = new double[] { 1.0 }; + gbl.rowWeights = new double[] { 1.0 }; setLayout(gbl); JSplitPane dataObjectGroupSplitPane = new JSplitPane(); @@ -105,8 +106,8 @@ public XMLDataObjectGroupEditorPanel() { add(dataObjectGroupSplitPane, gbc); gbl = new GridBagLayout(); - gbl.columnWeights = new double[]{1.0}; - gbl.rowWeights = new double[]{0.0, 1.0}; + gbl.columnWeights = new double[] { 1.0 }; + gbl.rowWeights = new double[] { 0.0, 1.0 }; JPanel dataObjectListPane = new JPanel(gbl); JLabel dataObjectListPaneLabel = new JLabel(translateTag("DataObjectGroup")); @@ -164,8 +165,8 @@ public XMLDataObjectGroupEditorPanel() { dataObjectGroupSplitPane.setLeftComponent(dataObjectListPane); gbl = new GridBagLayout(); - gbl.rowWeights = new double[]{0.0, 1.0, 0.0}; - gbl.columnWeights = new double[]{1.0}; + gbl.rowWeights = new double[] { 0.0, 1.0, 0.0 }; + gbl.columnWeights = new double[] { 1.0 }; JPanel dataObjectDetailPane = new JPanel(gbl); JLabel dataObjectDetailPaneLabel = new JLabel("Détails"); @@ -212,19 +213,27 @@ public void buttonOpenObject() { try { // Office bug workaround // This is a special patch to prevent Office to change a file when opening it to see the content... - if (System.getProperty("os.name").toLowerCase().contains("win")) - Files.setAttribute(path, "dos:readonly", true); + if (System.getProperty("os.name").toLowerCase().contains("win")) Files.setAttribute( + path, + "dos:readonly", + true + ); } catch (IOException e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Impossible de passer le fichier à ouvrir ["+path.toString()+"] en lecture seule \n->" + e.getMessage(), - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Impossible de passer le fichier à ouvrir [" + + path.toString() + + "] en lecture seule \n->" + + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); } Desktop.getDesktop().open(path.toFile()); } } - } catch (IOException ignored) { - } + } catch (IOException ignored) {} } private String chooseNewObject() { @@ -238,15 +247,25 @@ private String chooseNewObject() { throw new ResipException("Le nom choisi ne correspond pas à un fichier existant"); } return tmp.toString(); - } else - return null; + } else return null; } catch (Exception e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Le fichier choisi " + (tmp != null ? "[" + tmp.getAbsolutePath() + "]" : "") + " ne peut être pris en compte", - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de choisir le fichier " - + (tmp != null ? "[" + tmp.getAbsolutePath() + "]" : "") + "",e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Le fichier choisi " + + (tmp != null ? "[" + tmp.getAbsolutePath() + "]" : "") + + " ne peut être pris en compte", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.ERROR, + "Erreur fatale, impossible de choisir le fichier " + + (tmp != null ? "[" + tmp.getAbsolutePath() + "]" : "") + + "", + e + ); return null; } } @@ -261,13 +280,23 @@ private void buttonChangeObject() { bdo.removeFirstNamedMetadata("FileInfo"); bdo.extractTechnicalElements(null); } catch (SEDALibException e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Les informations techniques du fichier choisi [" + newBinary - + "] n'ont pas pu être toutes extraites, la mise à jour est partielle.", - "Erreur", UserInteractionDialog.ERROR_DIALOG, - null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Les informations techniques du fichier choisi [" + newBinary - + "] n'ont pas pu être toutes extraites, la mise à jour est partielle.",e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Les informations techniques du fichier choisi [" + + newBinary + + "] n'ont pas pu être toutes extraites, la mise à jour est partielle.", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.ERROR, + "Les informations techniques du fichier choisi [" + + newBinary + + "] n'ont pas pu être toutes extraites, la mise à jour est partielle.", + e + ); } selectDataObject(displayedDataObject); ResipGraphicApp.getTheApp().setModifiedContext(true); @@ -279,8 +308,10 @@ private void buttonEditDataObject() { XmlEditDialog xmlEditDialog = new XmlEditDialog(ResipGraphicApp.getTheWindow(), displayedDataObject); xmlEditDialog.setVisible(true); if (xmlEditDialog.getReturnValue()) { - ((DefaultListModel) dataObjectListViewer.getModel()).set(0, - ((DefaultListModel) dataObjectListViewer.getModel()).get(0)); + ((DefaultListModel) dataObjectListViewer.getModel()).set( + 0, + ((DefaultListModel) dataObjectListViewer.getModel()).get(0) + ); selectDataObject(displayedDataObject); ResipGraphicApp.getTheApp().setModifiedContext(true); } @@ -291,10 +322,8 @@ public void editDataObjectGroup(ArchiveUnit archiveUnit) throws SEDALibException this.editedArchiveUnit = archiveUnit; this.displayedDataObject = null; - if (editedArchiveUnit == null) - dataObjectListViewer.initDataObjectGroup(null); - else - dataObjectListViewer.initDataObjectGroup(editedArchiveUnit.getTheDataObjectGroup()); + if (editedArchiveUnit == null) dataObjectListViewer.initDataObjectGroup(null); + else dataObjectListViewer.initDataObjectGroup(editedArchiveUnit.getTheDataObjectGroup()); openObjectButton.setEnabled(false); changeObjectButton.setEnabled(false); @@ -324,8 +353,14 @@ public void selectDataObject(DataObject dataObject) { tmp = bdo.toSedaXmlFragments(); //tmp = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString(tmp); } catch (SEDALibException e) { - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Resip.InOut: Erreur à l'indentation du BinaryDataObject [" - + bdo.getInDataObjectPackageId() + "]",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.InOut: Erreur à l'indentation du BinaryDataObject [" + + bdo.getInDataObjectPackageId() + + "]", + e + ); } dataObjectDetailText.setText(tmp); openObjectButton.setEnabled(true); @@ -337,8 +372,14 @@ public void selectDataObject(DataObject dataObject) { tmp = pdo.toSedaXmlFragments(); //tmp = IndentXMLTool.getInstance(IndentXMLTool.STANDARD_INDENT).indentString(tmp); } catch (SEDALibException e) { - ResipLogger.getGlobalLogger().log(ResipLogger.STEP, "Resip.InOut: Erreur à l'indentation du PhysicalDataObject [" - + pdo.getInDataObjectPackageId() + "]",e); + ResipLogger.getGlobalLogger() + .log( + ResipLogger.STEP, + "Resip.InOut: Erreur à l'indentation du PhysicalDataObject [" + + pdo.getInDataObjectPackageId() + + "]", + e + ); } dataObjectDetailText.setText(tmp); openObjectButton.setEnabled(false); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java index b0c8815a..bbd38db8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/AutomaticGrowingTextArea.java @@ -60,25 +60,28 @@ public AutomaticGrowingTextArea(int maxLines) { scrollPane = new JScrollPane(this); - scrollPane.getViewport().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - inner.stateChanged(e); - } - }); + scrollPane + .getViewport() + .addChangeListener( + new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + inner.stateChanged(e); + } + } + ); } public void stateChanged(ChangeEvent e) { if (getText().length() > 0) { JViewport viewport = (JViewport) e.getSource(); int lineCount = viewport.getView().getMinimumSize().height / getRowHeight(); - if (currentLineNumber == Math.min(lineCount, maxLines)) - return; + if (currentLineNumber == Math.min(lineCount, maxLines)) return; currentLineNumber = Math.min(lineCount, maxLines); SEDAObjectEditorSimplePanel oesp = (SEDAObjectEditorSimplePanel) scrollPane.getParent().getParent(); setRows(currentLineNumber); GridBagLayout gbl = (GridBagLayout) oesp.getLayout(); - gbl.rowHeights = new int[]{currentLineNumber * getRowHeight() + 4}; + gbl.rowHeights = new int[] { currentLineNumber * getRowHeight() + 4 }; oesp.revalidate(); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java index a4c58062..7a0c1c99 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ExtensionButton.java @@ -47,10 +47,9 @@ public class ExtensionButton extends JButton implements ActionListener { - @FunctionalInterface public interface GetExtensionList { - List> getExtensionList() throws SEDALibException; + List> getExtensionList() throws SEDALibException; } @FunctionalInterface @@ -72,14 +71,14 @@ public ExtensionButton(GetExtensionList getExtensionList, DoExtend doExtend) { public void actionPerformed(ActionEvent ev) { if (ev.getActionCommand().equals("...")) { popupMenu = new JPopupMenu("..."); - List> extensionList; + List> extensionList; try { extensionList = getExtensionList.getExtensionList(); } catch (SEDALibException e) { extensionList = null; } if ((extensionList != null) && !extensionList.isEmpty()) { - for (Pair names : extensionList) { + for (Pair names : extensionList) { JMenuItem mi = new JMenuItem(names.getValue()); mi.addActionListener(this); mi.setActionCommand(names.getKey()); @@ -87,8 +86,6 @@ public void actionPerformed(ActionEvent ev) { } popupMenu.show(this, 0, this.getBounds().height); } - } - else - doExtend.doExtend(ev); + } else doExtend.doExtend(ev); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java index 9bf5287b..05775f95 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorCompositePanel.java @@ -97,7 +97,11 @@ public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor) throws SEDA * to close ou delete, and change label font * @throws SEDALibException the seda lib exception */ - public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor, JComponent moreMenuComponent, boolean topPanelFlag) throws SEDALibException { + public SEDAObjectEditorCompositePanel( + SEDAObjectEditor objectEditor, + JComponent moreMenuComponent, + boolean topPanelFlag + ) throws SEDALibException { super(objectEditor); this.objectEditorPanelGridBagConstraintsHashMap = new HashMap<>(); this.maxIndex = -1; @@ -105,12 +109,10 @@ public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor, JComponent GridBagConstraints gbc; gbl = new GridBagLayout(); - if (topPanelFlag) - gbl.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0}; - else - gbl.columnWidths = new int[]{16, SEDAObjectEditorConstants.computeLabelWidth() - 41, 10, 10, 0, 0, 0}; - gbl.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}; - gbl.rowHeights = new int[]{20, 3}; + if (topPanelFlag) gbl.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 }; + else gbl.columnWidths = new int[] { 16, SEDAObjectEditorConstants.computeLabelWidth() - 41, 10, 10, 0, 0, 0 }; + gbl.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; + gbl.rowHeights = new int[] { 20, 3 }; setLayout(gbl); setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT); @@ -144,8 +146,7 @@ public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor, JComponent editedObjectLabel = new JLabel(objectEditor.getName() + " : "); editedObjectLabel.setToolTipText(objectEditor.getTag()); - if (topPanelFlag) - editedObjectLabel.setFont(SEDAObjectEditor.BOLD_LABEL_FONT); + if (topPanelFlag) editedObjectLabel.setFont(SEDAObjectEditor.BOLD_LABEL_FONT); else { editedObjectLabel.setFont(SEDAObjectEditor.ITALIC_LABEL_FONT); editedObjectLabel.setForeground(SEDAObjectEditor.COMPOSITE_LABEL_COLOR); @@ -179,8 +180,7 @@ public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor, JComponent add(lessButton, gbc); } - if ((objectEditor.getFather() != null) && - objectEditor.getFather().canContainsMultiple(objectEditor.getTag())) { + if ((objectEditor.getFather() != null) && objectEditor.getFather().canContainsMultiple(objectEditor.getTag())) { JButton addButton = new JButton(); addButton.setIcon(new ImageIcon(getClass().getResource("/icon/list-add-very-small.png"))); addButton.setToolTipText("Ajouter un élément de même type..."); @@ -201,9 +201,12 @@ public SEDAObjectEditorCompositePanel(SEDAObjectEditor objectEditor, JComponent add(addButton, gbc); } - addMenu = new ExtensionButton(() -> { - return ((CompositeEditor) objectEditor).getExtensionList(); - }, (ActionEvent arg) -> doExtend(objectEditor, arg)); + addMenu = new ExtensionButton( + () -> { + return ((CompositeEditor) objectEditor).getExtensionList(); + }, + (ActionEvent arg) -> doExtend(objectEditor, arg) + ); addMenu.setToolTipText("Ajouter un élément dans la liste du menu déroulant..."); addMenu.setMargin(new Insets(0, 0, 0, 0)); addMenu.setBorderPainted(false); @@ -273,14 +276,16 @@ public void synchronizePanels() throws SEDALibException { gbc.gridx = 1; gbc.gridy = i + 2; gbc.gridwidth = 6; - oe.getSEDAObjectEditorPanel().setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, - SEDAObjectEditor.COMPOSITE_LABEL_SEPARATOR_COLOR)); + oe + .getSEDAObjectEditorPanel() + .setBorder( + BorderFactory.createMatteBorder(0, 1, 0, 0, SEDAObjectEditor.COMPOSITE_LABEL_SEPARATOR_COLOR) + ); add(oe.getSEDAObjectEditorPanel(), gbc); objectEditorPanelGridBagConstraintsHashMap.put(oe.getSEDAObjectEditorPanel(), gbc); continue; } - if (gbc.gridy == i + 2) - continue; + if (gbc.gridy == i + 2) continue; remove(oe.getSEDAObjectEditorPanel()); gbc.gridy = i + 2; add(oe.getSEDAObjectEditorPanel(), gbc); @@ -343,18 +348,17 @@ private void arrowEvent(ItemEvent event) { summary.setText("Extraction de la métadonnée impossible"); } summary.setCaretPosition(0); - for (SEDAObjectEditorPanel mep : objectEditorPanelGridBagConstraintsHashMap.keySet()) - mep.setVisible(false); + for (SEDAObjectEditorPanel mep : objectEditorPanelGridBagConstraintsHashMap.keySet()) mep.setVisible(false); separator.setVisible(false); editedObjectLabel.setHorizontalAlignment(SwingConstants.TRAILING); this.validate(); } else if (event.getStateChange() == DESELECTED) { - if (((CompositeEditor) objectEditor).hasSubeditorsCreatedWhenExpandedFlag()) - ((CompositeEditor) objectEditor).createSubEditors(); + if ( + ((CompositeEditor) objectEditor).hasSubeditorsCreatedWhenExpandedFlag() + ) ((CompositeEditor) objectEditor).createSubEditors(); summary.setVisible(false); addMenu.setVisible(true); - for (SEDAObjectEditorPanel mep : objectEditorPanelGridBagConstraintsHashMap.keySet()) - mep.setVisible(true); + for (SEDAObjectEditorPanel mep : objectEditorPanelGridBagConstraintsHashMap.keySet()) mep.setVisible(true); separator.setVisible(true); editedObjectLabel.setHorizontalAlignment(SwingConstants.LEADING); this.validate(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java index 12115691..23011cdb 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorPanel.java @@ -74,8 +74,7 @@ public void lessButton() { ((CompositeEditor) objectEditor.getFather()).removeChild(objectEditor); objectEditor.getFather().getSEDAObjectEditorPanelTopParent().validate(); } - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } /** @@ -87,7 +86,6 @@ public void addButton() { ((CompositeEditor) objectEditor.getFather()).addChild(objectEditor.getTag()); objectEditor.getFather().getSEDAObjectEditorPanelTopParent().validate(); } - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java index 956ed5de..3573eab9 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/SEDAObjectEditorSimplePanel.java @@ -57,13 +57,14 @@ public class SEDAObjectEditorSimplePanel extends SEDAObjectEditorPanel { * @param editPanel the edit panel * @throws SEDALibException the seda lib exception */ - public SEDAObjectEditorSimplePanel(SEDAObjectEditor objectEditor, JPanel labelPanel, JPanel editPanel) throws SEDALibException { + public SEDAObjectEditorSimplePanel(SEDAObjectEditor objectEditor, JPanel labelPanel, JPanel editPanel) + throws SEDALibException { super(objectEditor); - boolean multiple = ((objectEditor.getFather()!=null ) && - objectEditor.getFather().canContainsMultiple(objectEditor.getTag())); + boolean multiple = + ((objectEditor.getFather() != null) && objectEditor.getFather().canContainsMultiple(objectEditor.getTag())); GridBagLayout gbl = new GridBagLayout(); - gbl.columnWidths = new int[]{SEDAObjectEditorConstants.computeLabelWidth() - 20, 10, 10, 0}; - gbl.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0}; + gbl.columnWidths = new int[] { SEDAObjectEditorConstants.computeLabelWidth() - 20, 10, 10, 0 }; + gbl.columnWeights = new double[] { 0.0, 0.0, 0.0, 1.0 }; setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java index 081d6ca8..db9c71d3 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/structuredcomponents/ScrollablePanel.java @@ -58,24 +58,21 @@ * components added to the panel will be size to fill the area available, * based on the rules of the applicable layout manager of course. */ -public class ScrollablePanel extends JPanel - implements Scrollable, SwingConstants -{ - public enum ScrollableSizeHint - { +public class ScrollablePanel extends JPanel implements Scrollable, SwingConstants { + + public enum ScrollableSizeHint { NONE, FIT, - STRETCH + STRETCH, } - public enum IncrementType - { + public enum IncrementType { PERCENT, - PIXELS + PIXELS, } private ScrollableSizeHint scrollableHeight = ScrollableSizeHint.NONE; - private ScrollableSizeHint scrollableWidth = ScrollableSizeHint.NONE; + private ScrollableSizeHint scrollableWidth = ScrollableSizeHint.NONE; private IncrementInfo horizontalBlock; private IncrementInfo horizontalUnit; @@ -85,9 +82,8 @@ public enum IncrementType /** * Default constructor that uses a FlowLayout */ - public ScrollablePanel() - { - this( new FlowLayout() ); + public ScrollablePanel() { + this(new FlowLayout()); } /** @@ -95,10 +91,8 @@ public ScrollablePanel() * * @param layout the LayountManger for the panel */ - public ScrollablePanel(LayoutManager layout) - { - super( layout ); - + public ScrollablePanel(LayoutManager layout) { + super(layout); IncrementInfo block = new IncrementInfo(IncrementType.PERCENT, 100); IncrementInfo unit = new IncrementInfo(IncrementType.PERCENT, 10); @@ -113,8 +107,7 @@ public ScrollablePanel(LayoutManager layout) * * @return the ScrollableSizeHint enum for the height */ - public ScrollableSizeHint getScrollableHeight() - { + public ScrollableSizeHint getScrollableHeight() { return scrollableHeight; } @@ -132,8 +125,7 @@ public ScrollableSizeHint getScrollableHeight() * * @param scrollableHeight as represented by the ScrollableSizeHint enum. */ - public void setScrollableHeight(ScrollableSizeHint scrollableHeight) - { + public void setScrollableHeight(ScrollableSizeHint scrollableHeight) { this.scrollableHeight = scrollableHeight; revalidate(); } @@ -143,8 +135,7 @@ public void setScrollableHeight(ScrollableSizeHint scrollableHeight) * * @return the ScrollableSizeHint enum for the width */ - public ScrollableSizeHint getScrollableWidth() - { + public ScrollableSizeHint getScrollableWidth() { return scrollableWidth; } @@ -162,8 +153,7 @@ public ScrollableSizeHint getScrollableWidth() * * @param scrollableWidth as represented by the ScrollableSizeHint enum. */ - public void setScrollableWidth(ScrollableSizeHint scrollableWidth) - { + public void setScrollableWidth(ScrollableSizeHint scrollableWidth) { this.scrollableWidth = scrollableWidth; revalidate(); } @@ -173,8 +163,7 @@ public void setScrollableWidth(ScrollableSizeHint scrollableWidth) * * @return the block IncrementInfo for the specified orientation */ - public IncrementInfo getScrollableBlockIncrement(int orientation) - { + public IncrementInfo getScrollableBlockIncrement(int orientation) { return orientation == SwingConstants.HORIZONTAL ? horizontalBlock : verticalBlock; } @@ -190,8 +179,7 @@ public IncrementInfo getScrollableBlockIncrement(int orientation) * @param amount a value used with the IncrementType to determine the * scrollable amount */ - public void setScrollableBlockIncrement(int orientation, IncrementType type, int amount) - { + public void setScrollableBlockIncrement(int orientation, IncrementType type, int amount) { IncrementInfo info = new IncrementInfo(type, amount); setScrollableBlockIncrement(orientation, info); } @@ -204,10 +192,8 @@ public void setScrollableBlockIncrement(int orientation, IncrementType type, int * @param info An IncrementInfo object containing information of how to * calculate the scrollable amount. */ - public void setScrollableBlockIncrement(int orientation, IncrementInfo info) - { - switch(orientation) - { + public void setScrollableBlockIncrement(int orientation, IncrementInfo info) { + switch (orientation) { case SwingConstants.HORIZONTAL: horizontalBlock = info; break; @@ -224,8 +210,7 @@ public void setScrollableBlockIncrement(int orientation, IncrementInfo info) * * @return the unit IncrementInfo for the specified orientation */ - public IncrementInfo getScrollableUnitIncrement(int orientation) - { + public IncrementInfo getScrollableUnitIncrement(int orientation) { return orientation == SwingConstants.HORIZONTAL ? horizontalUnit : verticalUnit; } @@ -241,8 +226,7 @@ public IncrementInfo getScrollableUnitIncrement(int orientation) * @param amount a value used with the IncrementType to determine the * scrollable amount */ - public void setScrollableUnitIncrement(int orientation, IncrementType type, int amount) - { + public void setScrollableUnitIncrement(int orientation, IncrementType type, int amount) { IncrementInfo info = new IncrementInfo(type, amount); setScrollableUnitIncrement(orientation, info); } @@ -255,10 +239,8 @@ public void setScrollableUnitIncrement(int orientation, IncrementType type, int * @param info An IncrementInfo object containing information of how to * calculate the scrollable amount. */ - public void setScrollableUnitIncrement(int orientation, IncrementInfo info) - { - switch(orientation) - { + public void setScrollableUnitIncrement(int orientation, IncrementInfo info) { + switch (orientation) { case SwingConstants.HORIZONTAL: horizontalUnit = info; break; @@ -270,18 +252,14 @@ public void setScrollableUnitIncrement(int orientation, IncrementInfo info) } } -// Implement Scrollable interface + // Implement Scrollable interface - public Dimension getPreferredScrollableViewportSize() - { + public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); } - public int getScrollableUnitIncrement( - Rectangle visible, int orientation, int direction) - { - switch(orientation) - { + public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { + switch (orientation) { case SwingConstants.HORIZONTAL: return getScrollableIncrement(horizontalUnit, visible.width); case SwingConstants.VERTICAL: @@ -291,11 +269,8 @@ public int getScrollableUnitIncrement( } } - public int getScrollableBlockIncrement( - Rectangle visible, int orientation, int direction) - { - switch(orientation) - { + public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { + switch (orientation) { case SwingConstants.HORIZONTAL: return getScrollableIncrement(horizontalBlock, visible.width); case SwingConstants.VERTICAL: @@ -305,45 +280,33 @@ public int getScrollableBlockIncrement( } } - protected int getScrollableIncrement(IncrementInfo info, int distance) - { - if (info.getIncrement() == IncrementType.PIXELS) - return info.getAmount(); - else - return distance * info.getAmount() / 100; + protected int getScrollableIncrement(IncrementInfo info, int distance) { + if (info.getIncrement() == IncrementType.PIXELS) return info.getAmount(); + else return (distance * info.getAmount()) / 100; } - public boolean getScrollableTracksViewportWidth() - { - if (scrollableWidth == ScrollableSizeHint.NONE) - return false; + public boolean getScrollableTracksViewportWidth() { + if (scrollableWidth == ScrollableSizeHint.NONE) return false; - if (scrollableWidth == ScrollableSizeHint.FIT) - return true; + if (scrollableWidth == ScrollableSizeHint.FIT) return true; // STRETCH sizing, use the greater of the panel or viewport width - if (getParent() instanceof JViewport) - { + if (getParent() instanceof JViewport) { return (getParent().getWidth() > getPreferredSize().width); } return false; } - public boolean getScrollableTracksViewportHeight() - { - if (scrollableHeight == ScrollableSizeHint.NONE) - return false; + public boolean getScrollableTracksViewportHeight() { + if (scrollableHeight == ScrollableSizeHint.NONE) return false; - if (scrollableHeight == ScrollableSizeHint.FIT) - return true; + if (scrollableHeight == ScrollableSizeHint.FIT) return true; // STRETCH sizing, use the greater of the panel or viewport height - - if (getParent() instanceof JViewport) - { + if (getParent() instanceof JViewport) { return (getParent().getHeight() > getPreferredSize().height); } @@ -353,33 +316,26 @@ public boolean getScrollableTracksViewportHeight() /** * Helper class to hold the information required to calculate the scroll amount. */ - static class IncrementInfo - { + static class IncrementInfo { + private IncrementType type; private int amount; - public IncrementInfo(IncrementType type, int amount) - { + public IncrementInfo(IncrementType type, int amount) { this.type = type; this.amount = amount; } - public IncrementType getIncrement() - { + public IncrementType getIncrement() { return type; } - public int getAmount() - { + public int getAmount() { return amount; } - public String toString() - { - return - "ScrollablePanel[" + - type + ", " + - amount + "]"; + public String toString() { + return "ScrollablePanel[" + type + ", " + amount + "]"; } } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java index 3e984edd..a5e383ca 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListCellRenderer.java @@ -46,7 +46,6 @@ import java.awt.*; import static fr.gouv.vitam.tools.resip.frame.MainWindow.BOLD_LABEL_FONT; -import static fr.gouv.vitam.tools.resip.frame.MainWindow.GENERAL_BACKGROUND; import static fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditorConstants.translateTag; // TODO: Auto-generated Javadoc @@ -56,38 +55,49 @@ */ public class DataObjectListCellRenderer extends JLabel implements ListCellRenderer { - /** - * Instantiates a new data object list cell renderer. - */ - public DataObjectListCellRenderer() { - setOpaque(true); - setHorizontalAlignment(LEFT); - setVerticalAlignment(CENTER); - } + /** + * Instantiates a new data object list cell renderer. + */ + public DataObjectListCellRenderer() { + setOpaque(true); + setHorizontalAlignment(LEFT); + setVerticalAlignment(CENTER); + } - @Override - public Component getListCellRendererComponent(JList list, DataObject value, int index, - boolean isSelected, boolean cellHasFocus) { + @Override + public Component getListCellRendererComponent( + JList list, + DataObject value, + int index, + boolean isSelected, + boolean cellHasFocus + ) { + if (isSelected) { + setBackground(list.getSelectionBackground()); + setForeground(list.getSelectionForeground()); + } else { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } - if (isSelected) { - setBackground(list.getSelectionBackground()); - setForeground(list.getSelectionForeground()); - } else { - setBackground(list.getBackground()); - setForeground(list.getForeground()); - } - - setFont(BOLD_LABEL_FONT); - if (value instanceof BinaryDataObject) { - BinaryDataObject bdo=(BinaryDataObject)value; - StringType dataObjectVersion=bdo.getMetadataDataObjectVersion(); - setText(bdo.getInDataObjectPackageId()+"-"+(dataObjectVersion==null?translateTag("Unknown"):dataObjectVersion.getValue())); - } - else if (value instanceof PhysicalDataObject) { - PhysicalDataObject pdo=(PhysicalDataObject)value; - StringType dataObjectVersion=pdo.getMetadataDataObjectVersion(); - setText(pdo.getInDataObjectPackageId()+"-"+(dataObjectVersion==null?translateTag("Unknown"):dataObjectVersion.getValue())); - } - return this; - } + setFont(BOLD_LABEL_FONT); + if (value instanceof BinaryDataObject) { + BinaryDataObject bdo = (BinaryDataObject) value; + StringType dataObjectVersion = bdo.getMetadataDataObjectVersion(); + setText( + bdo.getInDataObjectPackageId() + + "-" + + (dataObjectVersion == null ? translateTag("Unknown") : dataObjectVersion.getValue()) + ); + } else if (value instanceof PhysicalDataObject) { + PhysicalDataObject pdo = (PhysicalDataObject) value; + StringType dataObjectVersion = pdo.getMetadataDataObjectVersion(); + setText( + pdo.getInDataObjectPackageId() + + "-" + + (dataObjectVersion == null ? translateTag("Unknown") : dataObjectVersion.getValue()) + ); + } + return this; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java index 62f11f2a..4ace18d2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListTransferHandler.java @@ -82,7 +82,9 @@ public int getSourceActions(JComponent c) { @Override public boolean canImport(TransferSupport ts) { - return ts.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (list.container.getEditedArchiveUnit() != null); + return ( + ts.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (list.container.getEditedArchiveUnit() != null) + ); } @Override @@ -91,17 +93,19 @@ public boolean importData(TransferSupport ts) { return false; } try { - List files = (List) ts.getTransferable().getTransferData( - DataFlavor.javaFileListFlavor); + List files = (List) ts.getTransferable().getTransferData(DataFlavor.javaFileListFlavor); if (files.size() < 1) { return false; } for (File file : files) { if (file.isDirectory()) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheApp().mainWindow, - "Il n'est pas possible de mettre\nen objet un répertoire", - "Avertissement", UserInteractionDialog.IMPORTANT_DIALOG, - null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheApp().mainWindow, + "Il n'est pas possible de mettre\nen objet un répertoire", + "Avertissement", + UserInteractionDialog.IMPORTANT_DIALOG, + null + ); return false; } } @@ -124,10 +128,14 @@ private void addToArchiveUnitDataObjectGroup(DataObject dataObject) { list.container.getEditedArchiveUnit().addDataObjectById(dataObjectGroup.getInDataObjectPackageId()); ResipGraphicApp.getTheWindow().treePane.displayedTreeNodeChanged(); } - if (dataObject instanceof BinaryDataObject) - list.container.getEditedArchiveUnit().getDataObjectPackage().addDataObjectPackageIdElement((BinaryDataObject) dataObject); - else - list.container.getEditedArchiveUnit().getDataObjectPackage().addDataObjectPackageIdElement((PhysicalDataObject) dataObject); + if (dataObject instanceof BinaryDataObject) list.container + .getEditedArchiveUnit() + .getDataObjectPackage() + .addDataObjectPackageIdElement((BinaryDataObject) dataObject); + else list.container + .getEditedArchiveUnit() + .getDataObjectPackage() + .addDataObjectPackageIdElement((PhysicalDataObject) dataObject); dataObjectGroup.addDataObject(dataObject); } catch (SEDALibException ignored) {} } @@ -138,15 +146,23 @@ private void addFileDataObject(Path path) { String filename = path.getFileName().toString(); if (filename.matches("__\\w+(_[0-9]+)?__PhysicalDataObjectMetadata.xml")) { try { - PhysicalDataObject pdo = new PhysicalDataObject(archiveUnit.getDataObjectPackage(), new String(Files.readAllBytes(path), StandardCharsets.UTF_8)); + PhysicalDataObject pdo = new PhysicalDataObject( + archiveUnit.getDataObjectPackage(), + new String(Files.readAllBytes(path), StandardCharsets.UTF_8) + ); addToArchiveUnitDataObjectGroup(pdo); ((DefaultListModel) list.getModel()).addElement(pdo); list.selectDataObjectListItem(pdo); } catch (IOException | SEDALibException e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Impossible d'ouvrir le fichier " + path.toString() - + "\nLes données peuvent avoir été parteillement modifiées", - "Erreur", UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Impossible d'ouvrir le fichier " + + path.toString() + + "\nLes données peuvent avoir été parteillement modifiées", + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); return; } } else { @@ -161,11 +177,15 @@ private void addFileDataObject(Path path) { dataObjectVersion = "Undefined_Undefined"; } } - BinaryDataObject bdo = new BinaryDataObject(archiveUnit.getDataObjectPackage(), path, filename, dataObjectVersion); + BinaryDataObject bdo = new BinaryDataObject( + archiveUnit.getDataObjectPackage(), + path, + filename, + dataObjectVersion + ); try { bdo.extractTechnicalElements(null); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} addToArchiveUnitDataObjectGroup(bdo); ((DefaultListModel) list.getModel()).addElement(bdo); list.selectDataObjectListItem(bdo); @@ -173,4 +193,4 @@ private void addFileDataObject(Path path) { ResipGraphicApp.getTheApp().currentWork.getCreationContext().setStructureChanged(true); ResipGraphicApp.getTheWindow().treePane.refreshTreeLabel(); } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java index dc61ad81..1fa97021 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectListViewer.java @@ -68,7 +68,6 @@ public class DataObjectListViewer extends JList implements ActionLis */ private BinaryDataObject actionBdo; - /** * Instantiates a new data object list viewer. * @@ -87,32 +86,37 @@ public void mousePressed(MouseEvent e) { if (index >= 0) { if (SwingUtilities.isLeftMouseButton(e)) { list.container.selectDataObject(list.getModel().getElementAt(index)); - if (e.getClickCount() == 2) - list.container.buttonOpenObject(); + if (e.getClickCount() == 2) list.container.buttonOpenObject(); } else if (SwingUtilities.isRightMouseButton(e)) { DataObject dataObject = list.getModel().getElementAt(index); if (dataObject instanceof BinaryDataObject) { BinaryDataObject bdo = (BinaryDataObject) dataObject; - FormatIdentification fi=bdo.getMetadataFormatIdentification(); - if ((fi!=null) && - (CompressedFileToArchiveTransferImporter.isKnownCompressedDroidFormat(fi.getSimpleMetadata("FormatId")))) { + FormatIdentification fi = bdo.getMetadataFormatIdentification(); + if ( + (fi != null) && + (CompressedFileToArchiveTransferImporter.isKnownCompressedDroidFormat( + fi.getSimpleMetadata("FormatId") + )) + ) { JPopupMenu popup = new JPopupMenu(); JMenuItem mi; mi = new JMenuItem("Remplacer par le décompressé"); mi.addActionListener(list); mi.setActionCommand("Expand"); - list.actionBdo =bdo; + list.actionBdo = bdo; popup.add(mi); popup.show((Component) e.getSource(), e.getX(), e.getY()); } - if ((fi!=null) && - (StoreExtractor.getProtocolFromDroidFormat(fi.getSimpleMetadata("FormatId"))!=null)) { + if ( + (fi != null) && + (StoreExtractor.getProtocolFromDroidFormat(fi.getSimpleMetadata("FormatId")) != null) + ) { JPopupMenu popup = new JPopupMenu(); JMenuItem mi; mi = new JMenuItem("Remplacer par l'extraction des messages"); mi.addActionListener(list); mi.setActionCommand("MailExtract"); - list.actionBdo =bdo; + list.actionBdo = bdo; popup.add(mi); popup.show((Component) e.getSource(), e.getX(), e.getY()); } @@ -144,19 +148,15 @@ public void keyPressed(KeyEvent e) { * * @param dataObjectGroup the data object group */ - public void initDataObjectGroup(DataObjectGroup dataObjectGroup){ + public void initDataObjectGroup(DataObjectGroup dataObjectGroup) { DefaultListModel model = (DefaultListModel) getModel(); model.removeAllElements(); if (dataObjectGroup != null) { - for (BinaryDataObject bdo : dataObjectGroup.getBinaryDataObjectList()) - model.addElement(bdo); - for (PhysicalDataObject pdo : dataObjectGroup.getPhysicalDataObjectList()) - model.addElement(pdo); + for (BinaryDataObject bdo : dataObjectGroup.getBinaryDataObjectList()) model.addElement(bdo); + for (PhysicalDataObject pdo : dataObjectGroup.getPhysicalDataObjectList()) model.addElement(pdo); } - if (model.isEmpty()) - container.selectDataObject(null); - else - container.selectDataObject(model.elementAt(0)); + if (model.isEmpty()) container.selectDataObject(null); + else container.selectDataObject(model.elementAt(0)); } /** @@ -181,10 +181,8 @@ public void selectDataObjectListItem(DataObject dataObject) { public void removeDataObject(DataObject dataObject) { container.getEditedArchiveUnit().getTheDataObjectGroup().removeDataObject(dataObject); ((DefaultListModel) getModel()).removeElement(dataObject); - if (((DefaultListModel) getModel()).isEmpty()) - container.selectDataObject(null); - else - container.selectDataObject(getModel().getElementAt(0)); + if (((DefaultListModel) getModel()).isEmpty()) container.selectDataObject(null); + else container.selectDataObject(getModel().getElementAt(0)); ResipGraphicApp.getTheApp().currentWork.getCreationContext().setStructureChanged(true); ResipGraphicApp.getTheWindow().treePane.refreshTreeLabel(); } @@ -193,17 +191,17 @@ public void removeDataObject(DataObject dataObject) { public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equals("Expand")) { ExpandThread.launchExpandThread(ResipGraphicApp.getTheWindow().treePane.getDisplayedTreeNode(), actionBdo); - } - else if (ae.getActionCommand().equals("MailExtract")) { - MailExtractThread.launchMailExtractThread(ResipGraphicApp.getTheWindow().treePane.getDisplayedTreeNode(), actionBdo); + } else if (ae.getActionCommand().equals("MailExtract")) { + MailExtractThread.launchMailExtractThread( + ResipGraphicApp.getTheWindow().treePane.getDisplayedTreeNode(), + actionBdo + ); } } @Override public Dimension getPreferredScrollableViewportSize() { - if (getModel().getSize() == 0) - return new Dimension(200, 128); - else - return super.getPreferredScrollableViewportSize(); + if (getModel().getSize() == 0) return new Dimension(200, 128); + else return super.getPreferredScrollableViewportSize(); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java index ee010fbe..1366fc30 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeCellRenderer.java @@ -48,30 +48,36 @@ */ public class DataObjectPackageTreeCellRenderer extends DefaultTreeCellRenderer { - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -7719104276024284446L; + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = -7719104276024284446L; - /* (non-Javadoc) - * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) - */ - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean exp, boolean leaf, - int row, boolean hasFocus) { - super.getTreeCellRendererComponent(tree, value, sel, exp, leaf, row, hasFocus); + /* (non-Javadoc) + * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) + */ + @Override + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean exp, + boolean leaf, + int row, + boolean hasFocus + ) { + super.getTreeCellRendererComponent(tree, value, sel, exp, leaf, row, hasFocus); - // Assuming you have a tree of DataObjectPackageTreeNode - DataObjectPackageTreeNode node = (DataObjectPackageTreeNode) value; + // Assuming you have a tree of DataObjectPackageTreeNode + DataObjectPackageTreeNode node = (DataObjectPackageTreeNode) value; - // If the node is a leaf and ends with "xxx" - if ((node.getParents()!=null) && (node.getParents().size()>1)) { - // Paint the node in blue - setForeground(new Color(25, 25, 225)); - } - else if (leaf) { - // Paint the node in blue - setForeground(new Color(25, 175, 25)); - } + // If the node is a leaf and ends with "xxx" + if ((node.getParents() != null) && (node.getParents().size() > 1)) { + // Paint the node in blue + setForeground(new Color(25, 25, 225)); + } else if (leaf) { + // Paint the node in blue + setForeground(new Color(25, 175, 25)); + } - return this; - } + return this; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java index f7be0822..6a8f43d4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeModel.java @@ -153,8 +153,10 @@ public DataObjectPackageTreeNode generateDataObjectPackageNodes(DataObjectPackag * @param parent the parent * @return the archive transfer tree node */ - public DataObjectPackageTreeNode generateArchiveUnitNode(ArchiveUnit archiveUnit, - DataObjectPackageTreeNode parent) { + public DataObjectPackageTreeNode generateArchiveUnitNode( + ArchiveUnit archiveUnit, + DataObjectPackageTreeNode parent + ) { DataObjectPackageTreeNode node; DataObjectPackageTreeNode childNode; int auRecursivCount = 0; @@ -163,8 +165,10 @@ public DataObjectPackageTreeNode generateArchiveUnitNode(ArchiveUnit archiveUnit node = findTreeNode(archiveUnit); if (node != null) { node.addParent(parent); - parent.actualiseRecursivCounts(node.getAuRecursivCount() + 1, - node.getOgRecursivCount() + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1)); + parent.actualiseRecursivCounts( + node.getAuRecursivCount() + 1, + node.getOgRecursivCount() + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1) + ); } else { node = new DataObjectPackageTreeNode(this, archiveUnit, parent); idElementTreeNodeMap.put(archiveUnit, node); @@ -172,17 +176,20 @@ public DataObjectPackageTreeNode generateArchiveUnitNode(ArchiveUnit archiveUnit for (ArchiveUnit au : archiveUnit.getChildrenAuList().getArchiveUnitList()) { childNode = generateArchiveUnitNode(au, node); auRecursivCount += childNode.getAuRecursivCount() + 1; - ogRecursivCount += childNode.getOgRecursivCount() + (au.getDataObjectRefList().getCount() == 0 ? 0 : 1); + ogRecursivCount += + childNode.getOgRecursivCount() + (au.getDataObjectRefList().getCount() == 0 ? 0 : 1); } } node.setAuRecursivCount(auRecursivCount); node.setOgRecursivCount(ogRecursivCount + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1)); - for (DataObject dataObject : archiveUnit.getDataObjectRefList().getDataObjectList()) - generateDataObjectNode(dataObject, node); - if (archiveUnit.getContentXmlData() != null) - node.setTitle(SEDAXMLEventReader.extractNamedElement("Title", archiveUnit.getContentXmlData())); - if (node.getTitle() == null) - node.setTitle("Can't find Title"); + for (DataObject dataObject : archiveUnit.getDataObjectRefList().getDataObjectList()) generateDataObjectNode( + dataObject, + node + ); + if (archiveUnit.getContentXmlData() != null) node.setTitle( + SEDAXMLEventReader.extractNamedElement("Title", archiveUnit.getContentXmlData()) + ); + if (node.getTitle() == null) node.setTitle("Can't find Title"); } return node; } @@ -202,8 +209,10 @@ public void generateDataObjectNode(DataObject dataObject, DataObjectPackageTreeN node.addParent(parent); } else { node = new DataObjectPackageTreeNode(this, dataObject, parent); - if (dataObject instanceof DataObjectPackageIdElement) - idElementTreeNodeMap.put((DataObjectPackageIdElement) dataObject, node); + if (dataObject instanceof DataObjectPackageIdElement) idElementTreeNodeMap.put( + (DataObjectPackageIdElement) dataObject, + node + ); } } @@ -223,7 +232,7 @@ public void actualiseDataObjectPackageNodes() { newIdElementTreeNodeMap.put(top.getArchiveUnit(), top); //remove all parents and counts - for (DataObjectPackageTreeNode cleanNode:idElementTreeNodeMap.values()){ + for (DataObjectPackageTreeNode cleanNode : idElementTreeNodeMap.values()) { cleanNode.setParents(new ArrayList<>()); cleanNode.setAuRecursivCount(0); cleanNode.setOgRecursivCount(0); @@ -237,7 +246,7 @@ public void actualiseDataObjectPackageNodes() { top.setAuRecursivCount(auRecursivCount); top.setOgRecursivCount(ogRecursivCount); - idElementTreeNodeMap=newIdElementTreeNodeMap; + idElementTreeNodeMap = newIdElementTreeNodeMap; } /** @@ -249,9 +258,11 @@ public void actualiseDataObjectPackageNodes() { * @param newIdElementTreeNodeMap the new id element tree node map * @return the archive transfer tree node */ - public DataObjectPackageTreeNode actualiseArchiveUnitNode(ArchiveUnit archiveUnit, - DataObjectPackageTreeNode parent, - HashMap newIdElementTreeNodeMap) { + public DataObjectPackageTreeNode actualiseArchiveUnitNode( + ArchiveUnit archiveUnit, + DataObjectPackageTreeNode parent, + HashMap newIdElementTreeNodeMap + ) { DataObjectPackageTreeNode node; DataObjectPackageTreeNode childNode; int auRecursivCount = 0; @@ -260,8 +271,10 @@ public DataObjectPackageTreeNode actualiseArchiveUnitNode(ArchiveUnit archiveUni node = findTreeNode(archiveUnit); if (!node.getParents().isEmpty()) { node.addParent(parent); - parent.actualiseRecursivCounts(node.getAuRecursivCount() + 1, - node.getOgRecursivCount() + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1)); + parent.actualiseRecursivCounts( + node.getAuRecursivCount() + 1, + node.getOgRecursivCount() + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1) + ); } else { node.addParent(parent); newIdElementTreeNodeMap.put(archiveUnit, node); @@ -269,13 +282,15 @@ public DataObjectPackageTreeNode actualiseArchiveUnitNode(ArchiveUnit archiveUni for (ArchiveUnit au : archiveUnit.getChildrenAuList().getArchiveUnitList()) { childNode = actualiseArchiveUnitNode(au, node, newIdElementTreeNodeMap); auRecursivCount += childNode.getAuRecursivCount() + 1; - ogRecursivCount += childNode.getOgRecursivCount() + (au.getDataObjectRefList().getCount() == 0 ? 0 : 1); + ogRecursivCount += + childNode.getOgRecursivCount() + (au.getDataObjectRefList().getCount() == 0 ? 0 : 1); } } node.setAuRecursivCount(auRecursivCount); node.setOgRecursivCount(ogRecursivCount + (archiveUnit.getDataObjectRefList().getCount() == 0 ? 0 : 1)); - for (DataObject dataObject : archiveUnit.getDataObjectRefList().getDataObjectList()) - actualiseDataObjectNode(dataObject, node,newIdElementTreeNodeMap); + for (DataObject dataObject : archiveUnit + .getDataObjectRefList() + .getDataObjectList()) actualiseDataObjectNode(dataObject, node, newIdElementTreeNodeMap); } return node; } @@ -288,8 +303,11 @@ public DataObjectPackageTreeNode actualiseArchiveUnitNode(ArchiveUnit archiveUni * @param parent the parent * @param newIdElementTreeNodeMap the new id element tree node map */ - public void actualiseDataObjectNode(DataObject dataObject, DataObjectPackageTreeNode parent, - HashMap newIdElementTreeNodeMap) { + public void actualiseDataObjectNode( + DataObject dataObject, + DataObjectPackageTreeNode parent, + HashMap newIdElementTreeNodeMap + ) { DataObjectPackageTreeNode node; //noinspection SuspiciousMethodCalls @@ -298,23 +316,25 @@ public void actualiseDataObjectNode(DataObject dataObject, DataObjectPackageTree node.addParent(parent); } else { node.addParent(parent); - if (dataObject instanceof DataObjectPackageIdElement) - newIdElementTreeNodeMap.put((DataObjectPackageIdElement) dataObject, node); + if (dataObject instanceof DataObjectPackageIdElement) newIdElementTreeNodeMap.put( + (DataObjectPackageIdElement) dataObject, + node + ); } } - - - private void oneStepBeyond(DataObjectPackageTreeNode node, List subPath, - List allPathsList) { + private void oneStepBeyond( + DataObjectPackageTreeNode node, + List subPath, + List allPathsList + ) { subPath.add(node); if (node == getRoot()) { Collections.reverse(subPath); allPathsList.add(subPath.toArray(new DataObjectPackageTreeNode[0])); Collections.reverse(subPath); } else { - for (DataObjectPackageTreeNode parent : node.getParents()) - oneStepBeyond(parent, subPath, allPathsList); + for (DataObjectPackageTreeNode parent : node.getParents()) oneStepBeyond(parent, subPath, allPathsList); } subPath.remove(node); } @@ -366,8 +386,7 @@ public DataObjectPackageTreeNode findTreeNode(ArchiveUnit au) { * @return the archive transfer tree node */ public DataObjectPackageTreeNode findTreeNode(DataObject dataObject) { - if (dataObject instanceof DataObjectPackageIdElement) - return idElementTreeNodeMap.get(dataObject); + if (dataObject instanceof DataObjectPackageIdElement) return idElementTreeNodeMap.get(dataObject); return null; } @@ -388,8 +407,10 @@ public void addIdElementTreeNode(ArchiveUnit au, DataObjectPackageTreeNode treeN * @param treeNode the tree node */ public void addIdElementTreeNode(DataObject dataObject, DataObjectPackageTreeNode treeNode) { - if (dataObject instanceof DataObjectPackageIdElement) - idElementTreeNodeMap.put((DataObjectPackageIdElement) dataObject, treeNode); + if (dataObject instanceof DataObjectPackageIdElement) idElementTreeNodeMap.put( + (DataObjectPackageIdElement) dataObject, + treeNode + ); } /** @@ -407,7 +428,6 @@ public void removeIdElementTreeNode(ArchiveUnit au) { * @param dataObject the data object */ public void removeIdElementTreeNode(DataObject dataObject) { - if (dataObject instanceof DataObjectPackageIdElement) - idElementTreeNodeMap.remove(dataObject); + if (dataObject instanceof DataObjectPackageIdElement) idElementTreeNodeMap.remove(dataObject); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java index 9a869a54..11bfc614 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNode.java @@ -91,8 +91,7 @@ private DataObjectPackageTreeNode(DataObjectPackageTreeModel treeModel, DataObje this.ogRecursivCount = 0; this.touchedCounter = 0; this.parents = new ArrayList(); - if (parent != null) - this.parents.add(parent); + if (parent != null) this.parents.add(parent); this.treeModel = treeModel; } @@ -103,7 +102,11 @@ private DataObjectPackageTreeNode(DataObjectPackageTreeModel treeModel, DataObje * @param archiveUnit the archive unit * @param parent the parent */ - public DataObjectPackageTreeNode(DataObjectPackageTreeModel treeModel, ArchiveUnit archiveUnit, DataObjectPackageTreeNode parent) { + public DataObjectPackageTreeNode( + DataObjectPackageTreeModel treeModel, + ArchiveUnit archiveUnit, + DataObjectPackageTreeNode parent + ) { this(treeModel, parent); this.archiveUnit = archiveUnit; treeModel.addIdElementTreeNode(archiveUnit, this); @@ -116,7 +119,11 @@ public DataObjectPackageTreeNode(DataObjectPackageTreeModel treeModel, ArchiveUn * @param dataObject the data object * @param parent the parent */ - public DataObjectPackageTreeNode(DataObjectPackageTreeModel treeModel, DataObject dataObject, DataObjectPackageTreeNode parent) { + public DataObjectPackageTreeNode( + DataObjectPackageTreeModel treeModel, + DataObject dataObject, + DataObjectPackageTreeNode parent + ) { this(treeModel, parent); this.dataObject = dataObject; treeModel.addIdElementTreeNode(dataObject, this); @@ -131,7 +138,6 @@ public DataObjectPackageTreeModel getTreeModel() { return treeModel; } - /** * Gets the data object. * @@ -156,16 +162,20 @@ public void setDataObject(DataObject dataObject) { @Override @JsonIgnore public TreeNode getChildAt(int childIndex) { - if ((archiveUnit == null) || (childIndex < 0)) - return null; + if ((archiveUnit == null) || (childIndex < 0)) return null; int sonAuCount = 0; - if (archiveUnit.getChildrenAuList() != null) - sonAuCount = archiveUnit.getChildrenAuList().getArchiveUnitList().size(); - if ((sonAuCount > 0) && (childIndex < sonAuCount)) - return treeModel.findTreeNode(archiveUnit.getChildrenAuList().getArchiveUnitList().get(childIndex)); + if (archiveUnit.getChildrenAuList() != null) sonAuCount = archiveUnit + .getChildrenAuList() + .getArchiveUnitList() + .size(); + if ((sonAuCount > 0) && (childIndex < sonAuCount)) return treeModel.findTreeNode( + archiveUnit.getChildrenAuList().getArchiveUnitList().get(childIndex) + ); else { try { - return treeModel.findTreeNode(archiveUnit.getDataObjectRefList().getDataObjectList().get(childIndex - sonAuCount)); + return treeModel.findTreeNode( + archiveUnit.getDataObjectRefList().getDataObjectList().get(childIndex - sonAuCount) + ); } catch (Exception e) { return null; } @@ -178,12 +188,11 @@ public TreeNode getChildAt(int childIndex) { @Override @JsonIgnore public int getChildCount() { - if (archiveUnit == null) - return 0; - if (archiveUnit.getChildrenAuList() == null) - return 0; - return archiveUnit.getChildrenAuList().getArchiveUnitList().size() - + archiveUnit.getDataObjectRefList().getCount(); + if (archiveUnit == null) return 0; + if (archiveUnit.getChildrenAuList() == null) return 0; + return ( + archiveUnit.getChildrenAuList().getArchiveUnitList().size() + archiveUnit.getDataObjectRefList().getCount() + ); } /** @@ -193,10 +202,8 @@ public int getChildCount() { */ @JsonIgnore public int getAuChildCount() { - if (archiveUnit == null) - return 0; - if (archiveUnit.getChildrenAuList() == null) - return 0; + if (archiveUnit == null) return 0; + if (archiveUnit.getChildrenAuList() == null) return 0; return archiveUnit.getChildrenAuList().getArchiveUnitList().size(); } @@ -206,10 +213,8 @@ public int getAuChildCount() { @Override @JsonIgnore public TreeNode getParent() { - if (parents.isEmpty()) - return null; - else - return parents.get(0); + if (parents.isEmpty()) return null; + else return parents.get(0); } /* (non-Javadoc) @@ -218,15 +223,14 @@ public TreeNode getParent() { @Override @JsonIgnore public int getIndex(TreeNode node) { - if ((archiveUnit == null) || (node == null)) - return -1; + if ((archiveUnit == null) || (node == null)) return -1; for (int i = 0; i < archiveUnit.getChildrenAuList().getCount(); i++) { - if (treeModel.findTreeNode(archiveUnit.getChildrenAuList().getArchiveUnitList().get(i)) == node) - return i; + if (treeModel.findTreeNode(archiveUnit.getChildrenAuList().getArchiveUnitList().get(i)) == node) return i; } for (int i = 0; i < archiveUnit.getDataObjectRefList().getCount(); i++) { - if (treeModel.findTreeNode(archiveUnit.getDataObjectRefList().getDataObjectList().get(i)) == node) - return i + archiveUnit.getChildrenAuList().getCount(); + if (treeModel.findTreeNode(archiveUnit.getDataObjectRefList().getDataObjectList().get(i)) == node) return ( + i + archiveUnit.getChildrenAuList().getCount() + ); } return -1; } @@ -254,15 +258,17 @@ public boolean isLeaf() { */ @Override public Enumeration children() { - if (archiveUnit == null) - return null; + if (archiveUnit == null) return null; List lstn = new ArrayList( - archiveUnit.getChildrenAuList().getCount() + archiveUnit.getDataObjectRefList().getCount()); - for (int i = 0; i < archiveUnit.getChildrenAuList().getCount(); i++) - lstn.add(treeModel.findTreeNode(archiveUnit.getChildrenAuList().getArchiveUnitList().get(i))); - for (int i = 0; i < archiveUnit.getDataObjectRefList().getCount(); i++) - lstn.add(treeModel.findTreeNode(archiveUnit.getDataObjectRefList().getDataObjectList().get(i))); + archiveUnit.getChildrenAuList().getCount() + archiveUnit.getDataObjectRefList().getCount() + ); + for (int i = 0; i < archiveUnit.getChildrenAuList().getCount(); i++) lstn.add( + treeModel.findTreeNode(archiveUnit.getChildrenAuList().getArchiveUnitList().get(i)) + ); + for (int i = 0; i < archiveUnit.getDataObjectRefList().getCount(); i++) lstn.add( + treeModel.findTreeNode(archiveUnit.getDataObjectRefList().getDataObjectList().get(i)) + ); return Collections.enumeration(lstn); } @@ -272,8 +278,7 @@ public Enumeration children() { * @param parent the parent */ public void addParent(DataObjectPackageTreeNode parent) { - if (parent != null) - parents.add(parent); + if (parent != null) parents.add(parent); } /** @@ -282,8 +287,7 @@ public void addParent(DataObjectPackageTreeNode parent) { * @param parent the parent */ public void removeParent(DataObjectPackageTreeNode parent) { - if (parent != null) - parents.remove(parent); + if (parent != null) parents.remove(parent); } /** @@ -366,10 +370,8 @@ public void addChildrenNode(DataObjectPackageTreeNode childNode) { childNode.addParent(this); auCount = childNode.getAuRecursivCount(); ogCount = childNode.getOgRecursivCount(); - if (childNode.getArchiveUnit() != null) - auCount++; - else - ogCount++; + if (childNode.getArchiveUnit() != null) auCount++; + else ogCount++; actualiseRecursivCounts(auCount, ogCount); } @@ -383,10 +385,8 @@ public void removeChildrenNode(DataObjectPackageTreeNode childNode) { childNode.removeParent(this); auCount = childNode.getAuRecursivCount(); ogCount = childNode.getOgRecursivCount(); - if (childNode.getArchiveUnit() != null) - auCount++; - else - ogCount++; + if (childNode.getArchiveUnit() != null) auCount++; + else ogCount++; actualiseRecursivCounts(-auCount, -ogCount); } @@ -396,13 +396,11 @@ public void removeChildrenNode(DataObjectPackageTreeNode childNode) { * @param aAttn the a attn * @return true, if is descendant */ -// Determines if aAttn is a descendant of this TreeNode + // Determines if aAttn is a descendant of this TreeNode public boolean isDescendant(DataObjectPackageTreeNode aAttn) { - if (aAttn == this) - return true; + if (aAttn == this) return true; for (DataObjectPackageTreeNode parent : aAttn.parents) { - if (isDescendant(parent)) - return true; + if (isDescendant(parent)) return true; } return false; } @@ -413,11 +411,10 @@ public boolean isDescendant(DataObjectPackageTreeNode aAttn) { * @param aAttn the a attn * @return true, if successful */ -// Determines if aAttn is a father of this TreeNode + // Determines if aAttn is a father of this TreeNode public boolean hasFather(DataObjectPackageTreeNode aAttn) { for (DataObjectPackageTreeNode parent : parents) { - if (aAttn.equals(parent)) - return true; + if (aAttn.equals(parent)) return true; } return false; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java index 19c45d11..c0a893f3 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeNodesTransferable.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; @@ -52,68 +52,77 @@ */ public class DataObjectPackageTreeNodesTransferable implements Transferable { - /** - * The paths. - */ - TreePath[] paths; + /** + * The paths. + */ + TreePath[] paths; - /** - * The flavors. - */ - static DataFlavor[] flavors; + /** + * The flavors. + */ + static DataFlavor[] flavors; - /** - * Gets the flavor. - * - * @return the flavor - */ - static public DataFlavor getFlavor(){ - if (flavors==null) - try { - flavors = new DataFlavor[] {new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=\"" - + javax.swing.tree.DefaultMutableTreeNode[].class.getName() + "\"")}; - } catch (ClassNotFoundException e) { - //impossible - } - return flavors[0]; - } + /** + * Gets the flavor. + * + * @return the flavor + */ + public static DataFlavor getFlavor() { + if (flavors == null) try { + flavors = new DataFlavor[] { + new DataFlavor( + DataFlavor.javaJVMLocalObjectMimeType + + ";class=\"" + + javax.swing.tree.DefaultMutableTreeNode[].class.getName() + + "\"" + ), + }; + } catch (ClassNotFoundException e) { + //impossible + } + return flavors[0]; + } - /** - * Instantiates a new archive transfer tree nodes transferable. - * - * @param paths the paths - */ - public DataObjectPackageTreeNodesTransferable(TreePath[] paths) { - this.paths = paths; - } + /** + * Instantiates a new archive transfer tree nodes transferable. + * + * @param paths the paths + */ + public DataObjectPackageTreeNodesTransferable(TreePath[] paths) { + this.paths = paths; + } - /* (non-Javadoc) - * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor) - */ + /* (non-Javadoc) + * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor) + */ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { - if (!isDataFlavorSupported(flavor)) - throw new UnsupportedFlavorException(flavor); - return paths; - } + if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); + return paths; + } - /* (non-Javadoc) - * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() - */ - public DataFlavor[] getTransferDataFlavors() { - if (flavors==null) - try { - flavors = new DataFlavor[] {new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=\"" - + javax.swing.tree.DefaultMutableTreeNode[].class.getName() + "\"")}; - } catch (ClassNotFoundException e) { - //impossible - } - return flavors; - } + /* (non-Javadoc) + * @see java.awt.datatransfer.Transferable#getTransferDataFlavors() + */ + public DataFlavor[] getTransferDataFlavors() { + if (flavors == null) try { + flavors = new DataFlavor[] { + new DataFlavor( + DataFlavor.javaJVMLocalObjectMimeType + + ";class=\"" + + javax.swing.tree.DefaultMutableTreeNode[].class.getName() + + "\"" + ), + }; + } catch (ClassNotFoundException e) { + //impossible + } + return flavors; + } - /* (non-Javadoc) - * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor) - */ - public boolean isDataFlavorSupported(DataFlavor flavor) { - return getFlavor().equals(flavor); - } + /* (non-Javadoc) + * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor) + */ + public boolean isDataFlavorSupported(DataFlavor flavor) { + return getFlavor().equals(flavor); + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java index 9b1aff45..cd84384e 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeTransferHandler.java @@ -36,7 +36,7 @@ * knowledge of the CeCILL-C license and that you accept its terms. */ /* - * + * */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; @@ -59,11 +59,11 @@ */ public class DataObjectPackageTreeTransferHandler extends TransferHandler { - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -6282321332303448872L; + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = -6282321332303448872L; - /** The tree. */ - private DataObjectPackageTreeViewer tree; + /** The tree. */ + private DataObjectPackageTreeViewer tree; /** * Instantiates a new archive transfer tree transfer handler. @@ -71,145 +71,135 @@ public class DataObjectPackageTreeTransferHandler extends TransferHandler { * @param tree the tree */ public DataObjectPackageTreeTransferHandler(DataObjectPackageTreeViewer tree) { - this.tree = tree; - } - - /* (non-Javadoc) - * @see javax.swing.TransferHandler#canImport(javax.swing.TransferHandler.TransferSupport) - */ - public boolean canImport(TransferHandler.TransferSupport support) { - if (!support.isDrop()) { - return false; - } - - support.setShowDropLocation(true); - if (!support.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor()) - && !support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - return false; - } - - JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); - TreePath dropPath = dl.getPath(); - DataObjectPackageTreeNode targetNode; - if (dl.getPath() != null) - targetNode = (DataObjectPackageTreeNode) dl.getPath().getLastPathComponent(); - else - targetNode = (DataObjectPackageTreeNode) tree.getModel().getRoot(); - - // if drag and drop treenodes - if (support.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor())) { - TreePath[] dragPaths; - try { - dragPaths = (TreePath[]) support.getTransferable() - .getTransferData(DataObjectPackageTreeNodesTransferable.getFlavor()); - } catch (UnsupportedFlavorException | IOException e) { - dragPaths = new TreePath[0]; - } - // Do not allow a drop on one of drag source father - for (TreePath dragPath : dragPaths) { - if (((DataObjectPackageTreeNode) dragPath.getLastPathComponent()) - .hasFather(targetNode)) - return false; - } - // On empty space ok only if not a leaf to drop and one of drag source is not already at rootlevel - if (dropPath == null) { - for (TreePath dragPath : dragPaths) - if (((DataObjectPackageTreeNode) dragPath.getLastPathComponent()).isLeaf()) - return false; - - return true; - } - // Do not allow drop on leaf - if (((DataObjectPackageTreeNode) dropPath.getLastPathComponent()).isLeaf()) - return false; - // Do not allow a drop on a drag source child not only in Jtree structure but in - // ArchiveUnit DAG structure - for (TreePath dragPath1 : dragPaths) { - if (((DataObjectPackageTreeNode) dragPath1.getLastPathComponent()) - .isDescendant((DataObjectPackageTreeNode) dropPath.getLastPathComponent())) - return false; - } - // Do not allow a drop of a leaf on a node which already has a leaf - ArchiveUnit dropAU = targetNode.getArchiveUnit(); - if ((dropAU != null) && (dropAU.getDataObjectRefList().getCount() > 0)) { - for (TreePath dragPath : dragPaths) { - if (((DataObjectPackageTreeNode) dragPath.getLastPathComponent()).isLeaf()) - return false; - } - } - } - // if drag and drop files - else { - // On empty space ok - if (dropPath == null) - return true; - // Do not allow a drop on leaf - return !((DataObjectPackageTreeNode) dropPath.getLastPathComponent()).isLeaf(); - } - return true; - - } - - /* (non-Javadoc) - * @see javax.swing.TransferHandler#createTransferable(javax.swing.JComponent) - */ - protected Transferable createTransferable(JComponent c) { - JTree tree = (JTree) c; - TreePath[] paths = tree.getSelectionPaths(); - if (paths != null) - return new DataObjectPackageTreeNodesTransferable(paths); - return null; - } - - /* (non-Javadoc) - * @see javax.swing.TransferHandler#getSourceActions(javax.swing.JComponent) - */ - public int getSourceActions(JComponent c) { - return COPY_OR_MOVE; - } - - /* (non-Javadoc) - * @see javax.swing.TransferHandler#importData(javax.swing.TransferHandler.TransferSupport) - */ - @SuppressWarnings("unchecked") - public boolean importData(TransferHandler.TransferSupport support) { - if (!canImport(support)) { - return false; - } - - // Get drop location info. - JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); - TreePath target; - if (dl.getPath() != null) - target = dl.getPath(); - else { - Object root=tree.getModel().getRoot(); - if (root==null) - // tree is empty and must be created by AddThread - target=null; - else - target = new TreePath(tree.getModel().getRoot()); - } - - // Extract transfer data and action - List files; - try { - Transferable t = support.getTransferable(); - if (t.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor())) { - TreePath[] paths = (TreePath[]) t.getTransferData(DataObjectPackageTreeNodesTransferable.getFlavor()); - for (TreePath path : paths) { - tree.addLink(path, target); - if ((support.getDropAction() & MOVE) == MOVE) - tree.removeSubTree(path,false); - } - } else if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { - files = (List) t.getTransferData(DataFlavor.javaFileListFlavor); - AddThread.launchAddThread(files, target); - } - } catch (UnsupportedFlavorException | java.io.IOException e) { - // forget it - } - return true; - } + this.tree = tree; + } + + /* (non-Javadoc) + * @see javax.swing.TransferHandler#canImport(javax.swing.TransferHandler.TransferSupport) + */ + public boolean canImport(TransferHandler.TransferSupport support) { + if (!support.isDrop()) { + return false; + } + + support.setShowDropLocation(true); + if ( + !support.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor()) && + !support.isDataFlavorSupported(DataFlavor.javaFileListFlavor) + ) { + return false; + } + + JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); + TreePath dropPath = dl.getPath(); + DataObjectPackageTreeNode targetNode; + if (dl.getPath() != null) targetNode = (DataObjectPackageTreeNode) dl.getPath().getLastPathComponent(); + else targetNode = (DataObjectPackageTreeNode) tree.getModel().getRoot(); + + // if drag and drop treenodes + if (support.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor())) { + TreePath[] dragPaths; + try { + dragPaths = (TreePath[]) support + .getTransferable() + .getTransferData(DataObjectPackageTreeNodesTransferable.getFlavor()); + } catch (UnsupportedFlavorException | IOException e) { + dragPaths = new TreePath[0]; + } + // Do not allow a drop on one of drag source father + for (TreePath dragPath : dragPaths) { + if (((DataObjectPackageTreeNode) dragPath.getLastPathComponent()).hasFather(targetNode)) return false; + } + // On empty space ok only if not a leaf to drop and one of drag source is not already at rootlevel + if (dropPath == null) { + for (TreePath dragPath : dragPaths) if ( + ((DataObjectPackageTreeNode) dragPath.getLastPathComponent()).isLeaf() + ) return false; + + return true; + } + // Do not allow drop on leaf + if (((DataObjectPackageTreeNode) dropPath.getLastPathComponent()).isLeaf()) return false; + // Do not allow a drop on a drag source child not only in Jtree structure but in + // ArchiveUnit DAG structure + for (TreePath dragPath1 : dragPaths) { + if ( + ((DataObjectPackageTreeNode) dragPath1.getLastPathComponent()).isDescendant( + (DataObjectPackageTreeNode) dropPath.getLastPathComponent() + ) + ) return false; + } + // Do not allow a drop of a leaf on a node which already has a leaf + ArchiveUnit dropAU = targetNode.getArchiveUnit(); + if ((dropAU != null) && (dropAU.getDataObjectRefList().getCount() > 0)) { + for (TreePath dragPath : dragPaths) { + if (((DataObjectPackageTreeNode) dragPath.getLastPathComponent()).isLeaf()) return false; + } + } + } + // if drag and drop files + else { + // On empty space ok + if (dropPath == null) return true; + // Do not allow a drop on leaf + return !((DataObjectPackageTreeNode) dropPath.getLastPathComponent()).isLeaf(); + } + return true; + } + + /* (non-Javadoc) + * @see javax.swing.TransferHandler#createTransferable(javax.swing.JComponent) + */ + protected Transferable createTransferable(JComponent c) { + JTree tree = (JTree) c; + TreePath[] paths = tree.getSelectionPaths(); + if (paths != null) return new DataObjectPackageTreeNodesTransferable(paths); + return null; + } + + /* (non-Javadoc) + * @see javax.swing.TransferHandler#getSourceActions(javax.swing.JComponent) + */ + public int getSourceActions(JComponent c) { + return COPY_OR_MOVE; + } + /* (non-Javadoc) + * @see javax.swing.TransferHandler#importData(javax.swing.TransferHandler.TransferSupport) + */ + @SuppressWarnings("unchecked") + public boolean importData(TransferHandler.TransferSupport support) { + if (!canImport(support)) { + return false; + } + + // Get drop location info. + JTree.DropLocation dl = (JTree.DropLocation) support.getDropLocation(); + TreePath target; + if (dl.getPath() != null) target = dl.getPath(); + else { + Object root = tree.getModel().getRoot(); + if (root == null) target = null; // tree is empty and must be created by AddThread + else target = new TreePath(tree.getModel().getRoot()); + } + + // Extract transfer data and action + List files; + try { + Transferable t = support.getTransferable(); + if (t.isDataFlavorSupported(DataObjectPackageTreeNodesTransferable.getFlavor())) { + TreePath[] paths = (TreePath[]) t.getTransferData(DataObjectPackageTreeNodesTransferable.getFlavor()); + for (TreePath path : paths) { + tree.addLink(path, target); + if ((support.getDropAction() & MOVE) == MOVE) tree.removeSubTree(path, false); + } + } else if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { + files = (List) t.getTransferData(DataFlavor.javaFileListFlavor); + AddThread.launchAddThread(files, target); + } + } catch (UnsupportedFlavorException | java.io.IOException e) { + // forget it + } + return true; + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java index c4d8181d..0987e462 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DataObjectPackageTreeViewer.java @@ -40,7 +40,6 @@ import fr.gouv.vitam.tools.mailextractlib.core.StoreExtractor; import fr.gouv.vitam.tools.resip.app.ResipGraphicApp; import fr.gouv.vitam.tools.resip.data.DustbinItem; -import fr.gouv.vitam.tools.resip.frame.MainWindow; import fr.gouv.vitam.tools.resip.frame.UserInteractionDialog; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents.TreeDataObjectPackageEditorPanel; import fr.gouv.vitam.tools.resip.threads.CompactThread; @@ -94,12 +93,18 @@ private BinaryDataObject getCompressedBinaryDataObject(DataObjectPackageTreeNode DataObject dataObject = treeNode.getDataObject(); if (dataObject instanceof DataObjectGroup) { DataObjectGroup dog = (DataObjectGroup) dataObject; - if ((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty()) && - (dog.getBinaryDataObjectList() != null)) { + if ( + (dog.getPhysicalDataObjectList() == null) || + ((dog.getPhysicalDataObjectList().isEmpty()) && (dog.getBinaryDataObjectList() != null)) + ) { for (BinaryDataObject bdo : dog.getBinaryDataObjectList()) { - FormatIdentification fi=bdo.getMetadataFormatIdentification(); - if ((fi != null) && - (CompressedFileToArchiveTransferImporter.isKnownCompressedDroidFormat(fi.getSimpleMetadata("FormatId")))) { + FormatIdentification fi = bdo.getMetadataFormatIdentification(); + if ( + (fi != null) && + (CompressedFileToArchiveTransferImporter.isKnownCompressedDroidFormat( + fi.getSimpleMetadata("FormatId") + )) + ) { return bdo; } } @@ -115,12 +120,18 @@ private BinaryDataObject getMailBinaryDataObject(DataObjectPackageTreeNode treeN DataObject dataObject = treeNode.getDataObject(); if (dataObject instanceof DataObjectGroup) { DataObjectGroup dog = (DataObjectGroup) dataObject; - if ((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty()) && - (dog.getBinaryDataObjectList() != null) && (dog.getBinaryDataObjectList().size() == 1)) { + if ( + (dog.getPhysicalDataObjectList() == null) || + ((dog.getPhysicalDataObjectList().isEmpty()) && + (dog.getBinaryDataObjectList() != null) && + (dog.getBinaryDataObjectList().size() == 1)) + ) { BinaryDataObject bdo = dog.getBinaryDataObjectList().get(0); - FormatIdentification fi=bdo.getMetadataFormatIdentification(); - if ((fi!=null) && - (StoreExtractor.getProtocolFromDroidFormat(fi.getSimpleMetadata("FormatId"))!=null)) { + FormatIdentification fi = bdo.getMetadataFormatIdentification(); + if ( + (fi != null) && + (StoreExtractor.getProtocolFromDroidFormat(fi.getSimpleMetadata("FormatId")) != null) + ) { return bdo; } } @@ -134,7 +145,10 @@ private BinaryDataObject getMailBinaryDataObject(DataObjectPackageTreeNode treeN * @param container the container * @param treeModel the tree model */ - public DataObjectPackageTreeViewer(TreeDataObjectPackageEditorPanel container, DataObjectPackageTreeModel treeModel) { + public DataObjectPackageTreeViewer( + TreeDataObjectPackageEditorPanel container, + DataObjectPackageTreeModel treeModel + ) { super(treeModel); this.container = container; final DataObjectPackageTreeViewer tree = this; @@ -149,7 +163,6 @@ public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { tree.container.selectTreePathItem(selPath); } else if (SwingUtilities.isRightMouseButton(e) && (stn.getParents() != null)) { - JPopupMenu popup = new JPopupMenu(); popupSTN = new ArrayList<>(5); popupSTN.add(stn); @@ -159,7 +172,9 @@ public void mousePressed(MouseEvent e) { int i = 0; for (DataObjectPackageTreeNode pstn : stn.getParents()) { popupSTN.add(pstn); - mi = new JMenuItem("Voir " + pstn.getArchiveUnit().getInDataObjectPackageId() + "-" + pstn.getTitle()); + mi = new JMenuItem( + "Voir " + pstn.getArchiveUnit().getInDataObjectPackageId() + "-" + pstn.getTitle() + ); mi.addActionListener(thisSTV); mi.setActionCommand("Link-" + (i++)); popup.add(mi); @@ -167,18 +182,18 @@ public void mousePressed(MouseEvent e) { asParents = true; } if (stn.getArchiveUnit() != null) { - if (asParents) - popup.addSeparator(); + if (asParents) popup.addSeparator(); mi = new JMenuItem("Ajouter une sous-ArchiveUnit"); mi.addActionListener(thisSTV); mi.setActionCommand("NewSubArchiveUnit"); popup.add(mi); if (ResipGraphicApp.getTheApp().interfaceParameters.isExperimentalFlag()) { - boolean isDocumentContainer=false; + boolean isDocumentContainer = false; try { - isDocumentContainer=(stn.getArchiveUnit() != null) - && (stn.getArchiveUnit().getContent() != null) - && (stn.getArchiveUnit().getContent().getFirstNamedMetadata("DocumentContainer") != null); + isDocumentContainer = (stn.getArchiveUnit() != null) && + (stn.getArchiveUnit().getContent() != null) && + (stn.getArchiveUnit().getContent().getFirstNamedMetadata("DocumentContainer") != + null); } catch (SEDALibException ignored) { // no real case } @@ -235,18 +250,23 @@ public void mousePressed(MouseEvent e) { KeyListener kl = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { - if (((e.getKeyCode() == KeyEvent.VK_DELETE) || (e.getKeyCode() == KeyEvent.VK_BACK_SPACE)) && - (tree.getSelectionPaths() != null)) { - if ((tree.getSelectionPaths().length > 1) - && (UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Vous allez effacer " + - tree.getSelectionPaths().length + " ArchiveUnit(s) ", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != ResipGraphicApp.OK_DIALOG)) - return; + if ( + ((e.getKeyCode() == KeyEvent.VK_DELETE) || (e.getKeyCode() == KeyEvent.VK_BACK_SPACE)) && + (tree.getSelectionPaths() != null) + ) { + if ( + (tree.getSelectionPaths().length > 1) && + (UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Vous allez effacer " + tree.getSelectionPaths().length + " ArchiveUnit(s) ", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + ResipGraphicApp.OK_DIALOG) + ) return; boolean confirmFlag = (tree.getSelectionPaths().length == 1); - for (TreePath path : tree.getSelectionPaths()) - removeSubTree(path, confirmFlag); + for (TreePath path : tree.getSelectionPaths()) removeSubTree(path, confirmFlag); } } }; @@ -277,14 +297,14 @@ public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().startsWith("Link-")) { String rank = ae.getActionCommand().substring(5); TreePath path = new TreePath( - ((DefaultTreeModel) getModel()).getPathToRoot(popupSTN.get(Integer.parseInt(rank) + 1))); + ((DefaultTreeModel) getModel()).getPathToRoot(popupSTN.get(Integer.parseInt(rank) + 1)) + ); setExpandsSelectedPaths(true); setSelectionPath(path); expandPath(path); scrollPathToVisible(path); } else if (ae.getActionCommand().equals("NewSubArchiveUnit")) { - addArchiveUnit(new TreePath( - ((DefaultTreeModel) getModel()).getPathToRoot(popupSTN.get(0)))); + addArchiveUnit(new TreePath(((DefaultTreeModel) getModel()).getPathToRoot(popupSTN.get(0)))); } else if (ae.getActionCommand().equals("CompactArchiveUnit")) { CompactThread.launchCompactThread(popupSTN.get(0)); } else if (ae.getActionCommand().equals("DeCompactArchiveUnit")) { @@ -292,11 +312,15 @@ public void actionPerformed(ActionEvent ae) { } else if (ae.getActionCommand().equals("NewRootArchiveUnit")) { addArchiveUnit(null); } else if (ae.getActionCommand().equals("Expand")) { - ExpandThread.launchExpandThread((DataObjectPackageTreeNode) uncompressedDogTreeNode.getParent(), - getCompressedBinaryDataObject(uncompressedDogTreeNode)); + ExpandThread.launchExpandThread( + (DataObjectPackageTreeNode) uncompressedDogTreeNode.getParent(), + getCompressedBinaryDataObject(uncompressedDogTreeNode) + ); } else if (ae.getActionCommand().equals("MailExtract")) { - MailExtractThread.launchMailExtractThread((DataObjectPackageTreeNode) uncompressedDogTreeNode.getParent(), - getMailBinaryDataObject(uncompressedDogTreeNode)); + MailExtractThread.launchMailExtractThread( + (DataObjectPackageTreeNode) uncompressedDogTreeNode.getParent(), + getMailBinaryDataObject(uncompressedDogTreeNode) + ); } } @@ -317,8 +341,7 @@ public void activateLongDataObjectPackageTreeItemName(boolean value) { private void nodeLabelStructureChanged(DataObjectPackageTreeModel stm, TreeNode root) { if (root != null) { stm.nodeChanged(root); - for (int i = 0; i < root.getChildCount(); i++) - nodeLabelStructureChanged(stm, root.getChildAt(i)); + for (int i = 0; i < root.getChildCount(); i++) nodeLabelStructureChanged(stm, root.getChildAt(i)); } } @@ -342,8 +365,14 @@ public boolean isActivatedLongDataObjectPackageTreeItemName() { } @Override - public String convertValueToText(final Object value, final boolean selected, final boolean expanded, - final boolean leaf, final int row, final boolean hasFocus) { + public String convertValueToText( + final Object value, + final boolean selected, + final boolean expanded, + final boolean leaf, + final int row, + final boolean hasFocus + ) { final DataObjectPackageTreeNode stn = (DataObjectPackageTreeNode) value; String result; @@ -351,13 +380,13 @@ public String convertValueToText(final Object value, final boolean selected, fin final ArchiveUnit archiveUnit = stn.getArchiveUnit(); result = stn.getTitle(); if (longDataObjectPackageTreeItemName) { - if (!leaf) - result += " (" + stn.getAuChildCount() + "/" + stn.getAuRecursivCount() + ")"; + if (!leaf) result += " (" + stn.getAuChildCount() + "/" + stn.getAuRecursivCount() + ")"; result += " - " + archiveUnit.getInDataObjectPackageId(); } } else { - result = stn.getDataObject().getClass().getSimpleName() + " " - + stn.getDataObject().getInDataObjectPackageId(); + result = stn.getDataObject().getClass().getSimpleName() + + " " + + stn.getDataObject().getInDataObjectPackageId(); } return result; } @@ -371,15 +400,12 @@ public String convertValueToText(final Object value, final boolean selected, fin * @return the path string */ static String getPathString(TreePath path) { - if (path == null) - return ""; + if (path == null) return ""; DataObjectPackageTreeNode attn = (DataObjectPackageTreeNode) path.getLastPathComponent(); - if (attn.getArchiveUnit() != null) - return getPathString(path.getParentPath()) + "->" + attn.getTitle(); - else - return getPathString(path.getParentPath()) + "->DataObject " - + attn.getDataObject().getInDataObjectPackageId(); - + if (attn.getArchiveUnit() != null) return getPathString(path.getParentPath()) + "->" + attn.getTitle(); + else return ( + getPathString(path.getParentPath()) + "->DataObject " + attn.getDataObject().getInDataObjectPackageId() + ); } /** @@ -422,27 +448,30 @@ public void addLink(TreePath addPath, TreePath targetPath) { private void resetTouchedFromNode(DataObjectPackageTreeNode node) { node.setTouchedCounter(0); - for (int i = 0; i < node.getChildCount(); i++) - resetTouchedFromNode((DataObjectPackageTreeNode) node.getChildAt(i)); + for (int i = 0; i < node.getChildCount(); i++) resetTouchedFromNode( + (DataObjectPackageTreeNode) node.getChildAt(i) + ); } private void countTouchedFromNode(DataObjectPackageTreeNode node) { node.incTouchedCounter(); - for (int i = 0; i < node.getChildCount(); i++) - countTouchedFromNode((DataObjectPackageTreeNode) node.getChildAt(i)); + for (int i = 0; i < node.getChildCount(); i++) countTouchedFromNode( + (DataObjectPackageTreeNode) node.getChildAt(i) + ); } private void removeNode(DataObjectPackageTreeNode parentNode, DataObjectPackageTreeNode node, DustbinItem de) { node.removeParent(parentNode); node.decTouchedCounter(); - if (node.getParents().size() > node.getTouchedCounter()) - return; + if (node.getParents().size() > node.getTouchedCounter()) return; de.addTreeNode(node); - for (int i = 0; i < node.getChildCount(); i++) - removeNode(node, (DataObjectPackageTreeNode) node.getChildAt(i), de); + for (int i = 0; i < node.getChildCount(); i++) removeNode( + node, + (DataObjectPackageTreeNode) node.getChildAt(i), + de + ); } - /** * Gets expansion state of the displayed tree. * @@ -469,8 +498,7 @@ public Map getExpansionState() { */ public void setExpansionState(Map expansionState) { for (Map.Entry e : expansionState.entrySet()) { - if (Boolean.TRUE.equals(e.getValue())) - expandPath(e.getKey()); + if (Boolean.TRUE.equals(e.getValue())) expandPath(e.getKey()); } } @@ -491,8 +519,7 @@ private void innerSetPathExpansionState(TreePath treePath, boolean state) { public void setPathExpansionState(TreePath treePath, boolean state) { // Temporarily remove all listeners that would otherwise // be flooded with TreeExpansionEvents - TreeExpansionListener[] expansionListeners = - getTreeExpansionListeners(); + TreeExpansionListener[] expansionListeners = getTreeExpansionListeners(); if (state) { for (TreeExpansionListener expansionListener : expansionListeners) { removeTreeExpansionListener(expansionListener); @@ -564,18 +591,22 @@ public void removeSubTree(TreePath removePath, boolean confirmFlag) { int auCount = childNode.getAuRecursivCount(); int ogCount = childNode.getOgRecursivCount(); - if (childNode.getArchiveUnit() != null) - auCount++; - if (childNode.getDataObject() != null) - ogCount++; - if (confirmFlag && (UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Vous allez effacer " + - (auCount == 0 ? "" : auCount + " ArchiveUnits ") + - (auCount != 0 && ogCount != 0 ? "et " : "") + - (ogCount == 0 ? "" : ogCount + " DataObjectGroups "), - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) != ResipGraphicApp.OK_DIALOG)) - return; + if (childNode.getArchiveUnit() != null) auCount++; + if (childNode.getDataObject() != null) ogCount++; + if ( + confirmFlag && + (UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Vous allez effacer " + + (auCount == 0 ? "" : auCount + " ArchiveUnits ") + + (auCount != 0 && ogCount != 0 ? "et " : "") + + (ogCount == 0 ? "" : ogCount + " DataObjectGroups "), + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) != + ResipGraphicApp.OK_DIALOG) + ) return; fatherNode.removeChildrenNode(childNode); @@ -607,10 +638,8 @@ public void removeSubTree(TreePath removePath, boolean confirmFlag) { */ public void addArchiveUnit(TreePath targetPath) { DataObjectPackageTreeNode targetNode; - if (targetPath == null) - targetNode = (DataObjectPackageTreeNode) getModel().getRoot(); - else - targetNode = (DataObjectPackageTreeNode) targetPath.getLastPathComponent(); + if (targetPath == null) targetNode = (DataObjectPackageTreeNode) getModel().getRoot(); + else targetNode = (DataObjectPackageTreeNode) targetPath.getLastPathComponent(); DataObjectPackageTreeModel treeModel = (DataObjectPackageTreeModel) getModel(); ArchiveUnit au = new ArchiveUnit(targetNode.getArchiveUnit().getDataObjectPackage()); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java index c3886e49..56517304 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DefaultTableHeaderCellRenderer.java @@ -37,10 +37,6 @@ */ package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers; -/** - * @(#)DefaultTableHeaderCellRenderer.java 1.0 02/24/09 - */ - import javax.swing.*; import javax.swing.RowSorter.SortKey; import javax.swing.table.DefaultTableCellRenderer; @@ -96,10 +92,15 @@ public DefaultTableHeaderCellRenderer() { * @return the default table header cell renderer */ @Override - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, - isSelected, hasFocus, row, column); + public Component getTableCellRendererComponent( + JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column + ) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); JTableHeader tableHeader = table.getTableHeader(); if (tableHeader != null) { setForeground(tableHeader.getForeground()); @@ -150,4 +151,4 @@ protected SortKey getSortKey(JTable table, int column) { } return null; } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java index 3d61aef0..76dec35d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/DuplicatesTableModel.java @@ -57,7 +57,7 @@ */ public class DuplicatesTableModel extends AbstractTableModel { - private final String[] entetes = {"Index", "Nb AU", "Nb DOG", "Noms", "Tailles", "Formats", "MimeTypes"}; + private final String[] entetes = { "Index", "Nb AU", "Nb DOG", "Noms", "Tailles", "Formats", "MimeTypes" }; private LinkedHashMap> dogByDogDigestMap; private HashMap> auByDogDigestMap; private String[] lotList; @@ -77,13 +77,13 @@ public HashMap> getDogByDogDigestMap() { * @param dogByDigestMap the dog by digest map * @param auByDigestMap the au by digest map */ - public void setData(LinkedHashMap> dogByDigestMap, - HashMap> auByDigestMap) { + public void setData( + LinkedHashMap> dogByDigestMap, + HashMap> auByDigestMap + ) { this.dogByDogDigestMap = dogByDigestMap; this.auByDogDigestMap = auByDigestMap; - if (dogByDigestMap != null) - this.lotList = dogByDigestMap.keySet().toArray(new String[0]); - + if (dogByDigestMap != null) this.lotList = dogByDigestMap.keySet().toArray(new String[0]); } /** @@ -92,8 +92,8 @@ public void setData(LinkedHashMap> dogByDigestMap, * @param dogList the dog list * @param row the row */ - public void changeRowDogList(List dogList, int row){ - dogByDogDigestMap.put(lotList[row],dogList); + public void changeRowDogList(List dogList, int row) { + dogByDogDigestMap.put(lotList[row], dogList); } @Override @@ -108,10 +108,8 @@ public String getColumnName(int columnIndex) { @Override public Class getColumnClass(int col) { - if (col < 3) - return Integer.class; - else - return String.class; + if (col < 3) return Integer.class; + else return String.class; } @Override @@ -123,8 +121,7 @@ public int getRowCount() { @Override public Object getValueAt(int arg0, int arg1) { if (dogByDogDigestMap == null) return null; - if (arg0 >= dogByDogDigestMap.size()) - throw new IllegalArgumentException(); + if (arg0 >= dogByDogDigestMap.size()) throw new IllegalArgumentException(); List dogList = dogByDogDigestMap.get(lotList[arg0]); switch (arg1) { case 0: @@ -136,29 +133,29 @@ public Object getValueAt(int arg0, int arg1) { case 3: List names = new ArrayList(); for (BinaryDataObject bdo : dogList.get(0).getBinaryDataObjectList()) { - FileInfo fi=bdo.getMetadataFileInfo(); - names.add((fi==null?null:fi.getSimpleMetadata("Filename"))); + FileInfo fi = bdo.getMetadataFileInfo(); + names.add((fi == null ? null : fi.getSimpleMetadata("Filename"))); } return String.join(", ", names); case 4: List sizes = new ArrayList(); for (BinaryDataObject bdo : dogList.get(0).getBinaryDataObjectList()) { - IntegerType s=bdo.getMetadataSize(); - sizes.add(String.format("%,d", (s==null?0:s.getValue()))); + IntegerType s = bdo.getMetadataSize(); + sizes.add(String.format("%,d", (s == null ? 0 : s.getValue()))); } return String.join(", ", sizes); case 5: List formats = new ArrayList(); for (BinaryDataObject bdo : dogList.get(0).getBinaryDataObjectList()) { - FormatIdentification fi=bdo.getMetadataFormatIdentification(); - formats.add((fi==null?null:fi.getSimpleMetadata("FormatId"))); + FormatIdentification fi = bdo.getMetadataFormatIdentification(); + formats.add((fi == null ? null : fi.getSimpleMetadata("FormatId"))); } return String.join(", ", formats); case 6: List types = new ArrayList(); for (BinaryDataObject bdo : dogList.get(0).getBinaryDataObjectList()) { - FormatIdentification fi=bdo.getMetadataFormatIdentification(); - types.add((fi==null?null:fi.getSimpleMetadata("MimeType"))); + FormatIdentification fi = bdo.getMetadataFormatIdentification(); + types.add((fi == null ? null : fi.getSimpleMetadata("MimeType"))); } return String.join(", ", types); default: @@ -173,10 +170,8 @@ public Object getValueAt(int arg0, int arg1) { * @return the row dog list */ public List getRowDogList(int row) { - if (dogByDogDigestMap != null) - return dogByDogDigestMap.get(lotList[row]); - else - return null; + if (dogByDogDigestMap != null) return dogByDogDigestMap.get(lotList[row]); + else return null; } /** @@ -186,9 +181,7 @@ public List getRowDogList(int row) { * @return the row au list */ public List getRowAuList(int row) { - if (auByDogDigestMap != null) - return auByDogDigestMap.get(lotList[row]); - else - return null; + if (auByDogDigestMap != null) return auByDogDigestMap.get(lotList[row]); + else return null; } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java index 95e59c45..4a3465e3 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticCellRenderer.java @@ -54,40 +54,39 @@ public class StatisticCellRenderer extends DefaultTableCellRenderer { * @return the string */ private static String readableFileSize(long size) { - if (size <= 0) - return "0"; + if (size <= 0) return "0"; final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, - boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table,"",isSelected,hasFocus,row,column); + public Component getTableCellRendererComponent( + JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column + ) { + super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column); String cellContent; if (value != null) { - if (value instanceof String) - cellContent = (String) value; + if (value instanceof String) cellContent = (String) value; else if (value instanceof Long) { - if ((Long) value == Long.MAX_VALUE) - cellContent = "-"; - else if (column==5) - cellContent=readableFileSize((Long)value); - else - cellContent = String.format("%,d", (Long) value); + if ((Long) value == Long.MAX_VALUE) cellContent = "-"; + else if (column == 5) cellContent = readableFileSize((Long) value); + else cellContent = String.format("%,d", (Long) value); } else cellContent = value.toString(); if (column <= 1) { setHorizontalAlignment(SwingConstants.CENTER); setText(cellContent); - } - else { + } else { setHorizontalAlignment(SwingConstants.RIGHT); - setText(cellContent+" "); - } - + setText(cellContent + " "); } + } return this; } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java index 3ce1f6b5..48af21d2 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/components/viewers/StatisticTableModel.java @@ -47,7 +47,7 @@ */ public class StatisticTableModel extends AbstractTableModel { - private final String[] entetes = { "Catégorie", "Nombre", "Taille min", "Taille moy", "Taille max", "Total"}; + private final String[] entetes = { "Catégorie", "Nombre", "Taille min", "Taille moy", "Taille max", "Total" }; private List statisticDataList; /** @@ -80,9 +80,8 @@ public String getColumnName(int columnIndex) { @Override public Class getColumnClass(int col) { - if (col >0) //second column accepts only Integer values - return Long.class; - else return String.class; //other columns accept String values + if (col > 0) return Long.class; //second column accepts only Integer values + else return String.class; //other columns accept String values } @Override @@ -94,8 +93,7 @@ public int getRowCount() { @Override public Object getValueAt(int arg0, int arg1) { if (statisticDataList == null) return null; - if (arg0 >= statisticDataList.size()) - throw new IllegalArgumentException(); + if (arg0 >= statisticDataList.size()) throw new IllegalArgumentException(); StatisticData statisticData = statisticDataList.get(arg0); switch (arg1) { case 0: @@ -103,23 +101,19 @@ public Object getValueAt(int arg0, int arg1) { case 1: return statisticData.getObjectNumber(); case 2: - if (statisticData.getObjectNumber() == 0) - return Long.MAX_VALUE; + if (statisticData.getObjectNumber() == 0) return Long.MAX_VALUE; return statisticData.getMinSize(); case 3: - if (statisticData.getObjectNumber() == 0) - return Long.MAX_VALUE; + if (statisticData.getObjectNumber() == 0) return Long.MAX_VALUE; return Math.round(statisticData.getMeanSize()); case 4: - if (statisticData.getObjectNumber() == 0) - return Long.MAX_VALUE; + if (statisticData.getObjectNumber() == 0) return Long.MAX_VALUE; return statisticData.getMaxSize(); case 5: - if (statisticData.getObjectNumber() == 0) - return Long.MAX_VALUE; + if (statisticData.getObjectNumber() == 0) return Long.MAX_VALUE; return statisticData.getTotalSize(); default: throw new IllegalArgumentException(); } } -} \ No newline at end of file +} diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java index 26d71f56..951e562f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/AbstractUnitaryDataObjectEditor.java @@ -58,7 +58,6 @@ */ public abstract class AbstractUnitaryDataObjectEditor extends CompositeEditor { - /** * Explicative texts */ @@ -86,16 +85,20 @@ public String getTag() { @Override public String getName() { - if (editedObject == null) - return translateTag(getTag()) + " - " + translateTag(UNKNOWN); - return translateTag(getTag()) + " - " + - (getAbstractUnitaryDataObject().getInDataObjectPackageId() == null ? TO_BE_DEFINED : - getAbstractUnitaryDataObject().getInDataObjectPackageId()); + if (editedObject == null) return translateTag(getTag()) + " - " + translateTag(UNKNOWN); + return ( + translateTag(getTag()) + + " - " + + (getAbstractUnitaryDataObject().getInDataObjectPackageId() == null + ? TO_BE_DEFINED + : getAbstractUnitaryDataObject().getInDataObjectPackageId()) + ); } @Override public AbstractUnitaryDataObject extractEditedObject() throws SEDALibException { - AbstractUnitaryDataObject tmpAbstractUnitaryDataObject = ((AbstractUnitaryDataObject) editedObject).getEmptySameAbstractUnitaryDataObjet(); + AbstractUnitaryDataObject tmpAbstractUnitaryDataObject = + ((AbstractUnitaryDataObject) editedObject).getEmptySameAbstractUnitaryDataObjet(); for (SEDAObjectEditor objectEditor : objectEditorList) { SEDAMetadata subMetadata = (SEDAMetadata) objectEditor.extractEditedObject(); @@ -107,8 +110,7 @@ public AbstractUnitaryDataObject extractEditedObject() throws SEDALibException { } protected String getItOrUnknown(String str) { - if ((str == null) || (str.isEmpty())) - return translateTag(UNKNOWN); + if ((str == null) || (str.isEmpty())) return translateTag(UNKNOWN); return str; } @@ -117,10 +119,8 @@ public String getSummary() throws SEDALibException { List summaryList = new ArrayList<>(objectEditorList.size()); String tmp; for (SEDAMetadata sm : getAbstractUnitaryDataObject().getMetadataList()) { - if (sm instanceof StringType) - summaryList.add(((StringType) sm).getValue()); - else if (sm instanceof PersistentIdentifier) - summaryList.add(((PersistentIdentifier) sm).getSummary()); + if (sm instanceof StringType) summaryList.add(((StringType) sm).getValue()); + else if (sm instanceof PersistentIdentifier) summaryList.add(((PersistentIdentifier) sm).getSummary()); } return String.join(", ", summaryList); } @@ -147,20 +147,22 @@ public List> getExtensionList() throws SEDALibException { used.add(soe.getTag()); } for (String metadataName : getAbstractUnitaryDataObject().getMetadataMap().keySet()) { - if (metadataName.endsWith("SystemId")) - continue; - ComplexListMetadataKind complexListMetadataKind = getAbstractUnitaryDataObject().getMetadataMap().get(metadataName); - if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) - result.add(Pair.of(metadataName, translateTag(metadataName))); + if (metadataName.endsWith("SystemId")) continue; + ComplexListMetadataKind complexListMetadataKind = getAbstractUnitaryDataObject() + .getMetadataMap() + .get(metadataName); + if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) result.add( + Pair.of(metadataName, translateTag(metadataName)) + ); } - if (!getAbstractUnitaryDataObject().isNotExpandable()) - result.add(Pair.of("AnyXMLType", translateTag("AnyXMLType"))); + if (!getAbstractUnitaryDataObject().isNotExpandable()) result.add( + Pair.of("AnyXMLType", translateTag("AnyXMLType")) + ); result.sort((p1, p2) -> p1.getValue().compareTo(p2.getValue())); return result; } - protected void replaceOrAddObjectEditor(SEDAObjectEditor newObjectEditor) throws SEDALibException { ComplexListMetadataKind cmk = getAbstractUnitaryDataObject().getMetadataMap().get(newObjectEditor.getTag()); if (cmk != null && !cmk.isMany()) { @@ -182,14 +184,16 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA boolean manyFlag; addOrderIndex = getAbstractUnitaryDataObject().indexOfMetadata(metadataName); i = 0; - if (addOrderIndex == -1) - return Integer.MAX_VALUE; + if (addOrderIndex == -1) return Integer.MAX_VALUE; else { manyFlag = getAbstractUnitaryDataObject().getMetadataMap().get(metadataName).isMany(); for (SEDAObjectEditor soe : objectEditorList) { curOrderIndex = getAbstractUnitaryDataObject().indexOfMetadata(soe.getTag()); - if ((!manyFlag) && (curOrderIndex == addOrderIndex) || - (curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) { + if ( + ((!manyFlag) && (curOrderIndex == addOrderIndex)) || + (curOrderIndex == -1) || + (curOrderIndex > addOrderIndex) + ) { break; } i++; @@ -201,7 +205,11 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA @Override public void addChild(String metadataName) throws SEDALibException { SEDAMetadata sedaMetadata; - SEDAMetadata sm = createSEDAMetadataSample(getAbstractUnitaryDataObject().getMetadataMap().get(metadataName).getMetadataClass().getSimpleName(), metadataName, true); + SEDAMetadata sm = createSEDAMetadataSample( + getAbstractUnitaryDataObject().getMetadataMap().get(metadataName).getMetadataClass().getSimpleName(), + metadataName, + true + ); replaceOrAddObjectEditor(createSEDAObjectEditor(sm, this)); updateObjectEditorList(); } @@ -216,8 +224,7 @@ public void removeChild(SEDAObjectEditor objectEditor) throws SEDALibException { public boolean canContainsMultiple(String metadataName) { try { ComplexListMetadataKind cmk = getAbstractUnitaryDataObject().getMetadataMap().get(metadataName); - if (cmk != null) - return cmk.isMany(); + if (cmk != null) return cmk.isMany(); return !getAbstractUnitaryDataObject().isNotExpandable(); } catch (SEDALibException ignored) { // Exception impossible diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java index df434d66..358f174d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ArchiveUnitEditor.java @@ -85,7 +85,11 @@ public String getTag() { @Override public String getName() { - return translateTag("ArchiveUnit") + " - " + (editedObject == null ? translateTag("Unknown") : getArchiveUnitMetadata().getInDataObjectPackageId()); + return ( + translateTag("ArchiveUnit") + + " - " + + (editedObject == null ? translateTag("Unknown") : getArchiveUnitMetadata().getInDataObjectPackageId()) + ); } @Override @@ -120,27 +124,30 @@ public String getSummary() throws SEDALibException { private void updateObjectEditorList() throws SEDALibException { List result = new ArrayList(); - for (int i = 0; i < 3; i++) - if (objectEditorArray[i] != null) - result.add(objectEditorArray[i]); + for (int i = 0; i < 3; i++) if (objectEditorArray[i] != null) result.add(objectEditorArray[i]); objectEditorList = result; ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).synchronizePanels(); } private void renewObjectEditorList() throws SEDALibException { - for (int i = 0; i < 3; i++) - objectEditorArray[i] = null; + for (int i = 0; i < 3; i++) objectEditorArray[i] = null; if (getArchiveUnitMetadata() != null) { if (getArchiveUnitMetadata().getContent() != null) { - objectEditorArray[0] = SEDAObjectEditor.createSEDAObjectEditor(getArchiveUnitMetadata().getContent(), this); + objectEditorArray[0] = SEDAObjectEditor.createSEDAObjectEditor( + getArchiveUnitMetadata().getContent(), + this + ); ((CompositeEditor) objectEditorArray[0]).doExpand(true, false); } if (getArchiveUnitMetadata().getManagement() != null) { - objectEditorArray[1] = SEDAObjectEditor.createSEDAObjectEditor(getArchiveUnitMetadata().getManagement(), this); + objectEditorArray[1] = SEDAObjectEditor.createSEDAObjectEditor( + getArchiveUnitMetadata().getManagement(), + this + ); ((CompositeEditor) objectEditorArray[1]).doExpand(true, false); } - if (getArchiveUnitMetadata().getArchiveUnitProfile() != null) - objectEditorArray[2] = SEDAObjectEditor.createSEDAObjectEditor(getArchiveUnitMetadata().getArchiveUnitProfile(), this); + if (getArchiveUnitMetadata().getArchiveUnitProfile() != null) objectEditorArray[2] = + SEDAObjectEditor.createSEDAObjectEditor(getArchiveUnitMetadata().getArchiveUnitProfile(), this); } updateObjectEditorList(); @@ -154,13 +161,15 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { @Override public List> getExtensionList() { - if (getArchiveUnitMetadata() == null) - return new ArrayList>(); + if (getArchiveUnitMetadata() == null) return new ArrayList>(); - List> extensionList = new ArrayList>(Arrays.asList( + List> extensionList = new ArrayList>( + Arrays.asList( Pair.of("ArchiveUnitProfile", translateTag("ArchiveUnitProfile")), Pair.of("Content", translateTag("Content")), - Pair.of("Management", translateTag("Management")))); + Pair.of("Management", translateTag("Management")) + ) + ); for (SEDAObjectEditor me : objectEditorList) { String name = me.getTag(); @@ -186,8 +195,9 @@ public void addChild(String metadataName) throws SEDALibException { objectEditorArray[2] = createSEDAObjectEditor(sedaMetadata, this); break; } - if (sedaMetadata == null) - throw new SEDALibException("La métadonnée [" + metadataName + "] n'existe pas dans un ArchiveUnit"); + if (sedaMetadata == null) throw new SEDALibException( + "La métadonnée [" + metadataName + "] n'existe pas dans un ArchiveUnit" + ); updateObjectEditorList(); } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java index c132bc4d..a593ecc4 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/BinaryDataObjectEditor.java @@ -43,14 +43,14 @@ import fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditor; import fr.gouv.vitam.tools.resip.sedaobjecteditor.SEDAObjectEditorConstants; import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.structuredcomponents.SEDAObjectEditorCompositePanel; -import fr.gouv.vitam.tools.sedalib.metadata.content.PersistentIdentifier; -import fr.gouv.vitam.tools.sedalib.metadata.namedtype.*; -import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import fr.gouv.vitam.tools.sedalib.core.BinaryDataObject; import fr.gouv.vitam.tools.sedalib.droid.DroidIdentifier; import fr.gouv.vitam.tools.sedalib.metadata.SEDAMetadata; +import fr.gouv.vitam.tools.sedalib.metadata.content.PersistentIdentifier; import fr.gouv.vitam.tools.sedalib.metadata.data.FileInfo; import fr.gouv.vitam.tools.sedalib.metadata.data.FormatIdentification; +import fr.gouv.vitam.tools.sedalib.metadata.namedtype.*; +import fr.gouv.vitam.tools.sedalib.utils.LocalDateTimeUtil; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import fr.gouv.vitam.tools.sedalib.utils.digest.DigestSha512; import uk.gov.nationalarchives.droid.core.interfaces.IdentificationResult; @@ -107,10 +107,8 @@ public String getSummary() throws SEDALibException { List summaryList = new ArrayList<>(objectEditorList.size()); String tmp; for (SEDAMetadata sm : getBinaryDataObject().getMetadataList()) { - if (sm instanceof StringType) - summaryList.add(((StringType) sm).getValue()); - else if (sm instanceof PersistentIdentifier) - summaryList.add(((PersistentIdentifier) sm).getSummary()); + if (sm instanceof StringType) summaryList.add(((StringType) sm).getValue()); + else if (sm instanceof PersistentIdentifier) summaryList.add(((PersistentIdentifier) sm).getSummary()); else if (sm instanceof FileInfo) { summaryList.add(getItOrUnknown(((FileInfo) sm).getSimpleMetadata("Filename"))); summaryList.add(getItOrUnknown(((FileInfo) sm).getSimpleMetadata("LastModified"))); @@ -118,7 +116,6 @@ else if (sm instanceof FileInfo) { summaryList.add(getItOrUnknown(((FormatIdentification) sm).getSimpleMetadata("MimeType"))); summaryList.add(getItOrUnknown(((FormatIdentification) sm).getSimpleMetadata("FormatId"))); } - } return String.join(", ", summaryList); } @@ -163,14 +160,24 @@ private boolean setReadOnly(Path path) { try { // Office bug workaround // This is a special patch to prevent Office to change a file when opening it to see the content... - if (System.getProperty("os.name").toLowerCase().contains("win")) - Files.setAttribute(path, "dos:readonly", true); + if (System.getProperty("os.name").toLowerCase().contains("win")) Files.setAttribute( + path, + "dos:readonly", + true + ); } catch (IOException e) { - return UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Impossible de passer le fichier à ouvrir [" + path + - "] en lecture seule\nVoulez-vous tout de même l'ouvrir?", - "Confirmation", UserInteractionDialog.WARNING_DIALOG, - null) == OK_DIALOG; + return ( + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Impossible de passer le fichier à ouvrir [" + + path + + "] en lecture seule\nVoulez-vous tout de même l'ouvrir?", + "Confirmation", + UserInteractionDialog.WARNING_DIALOG, + null + ) == + OK_DIALOG + ); } return true; } @@ -178,51 +185,64 @@ private boolean setReadOnly(Path path) { private void openButton() { if (editedOnDiskPath != null) { try { - if (setReadOnly(editedOnDiskPath)) - Desktop.getDesktop().open(editedOnDiskPath.toFile()); - } catch (IOException ignored) {//NOSONAR - } + if (setReadOnly(editedOnDiskPath)) Desktop.getDesktop().open(editedOnDiskPath.toFile()); + } catch (IOException ignored) {} //NOSONAR } } private SEDAObjectEditor getSEDAObjectEditor(String metadataName) { for (SEDAObjectEditor soe : objectEditorList) { - if (soe.getTag().equals(metadataName)) - return soe; + if (soe.getTag().equals(metadataName)) return soe; } return null; } private void extractFileMetadataInEditors() { try { - replaceOrAddObjectEditor( createSEDAObjectEditor(new DigestType("MessageDigest", - DigestSha512.compute(editedOnDiskPath), "SHA-512"), this)); - replaceOrAddObjectEditor( createSEDAObjectEditor(new IntegerType("Size" , - Files.size(editedOnDiskPath)), this)); + replaceOrAddObjectEditor( + createSEDAObjectEditor( + new DigestType("MessageDigest", DigestSha512.compute(editedOnDiskPath), "SHA-512"), + this + ) + ); + replaceOrAddObjectEditor( + createSEDAObjectEditor(new IntegerType("Size", Files.size(editedOnDiskPath)), this) + ); boolean expanded = false; - SEDAObjectEditor formatInformationObjectEditor= getSEDAObjectEditor("FormatIdentification"); - if (formatInformationObjectEditor != null) - expanded = ((SEDAObjectEditorCompositePanel) formatInformationObjectEditor.getSEDAObjectEditorPanel()).isExpanded(); + SEDAObjectEditor formatInformationObjectEditor = getSEDAObjectEditor("FormatIdentification"); + if (formatInformationObjectEditor != null) expanded = + ((SEDAObjectEditorCompositePanel) formatInformationObjectEditor.getSEDAObjectEditorPanel()).isExpanded(); IdentificationResult ir = DroidIdentifier.getInstance().getIdentificationResult(editedOnDiskPath); FormatIdentification formatIdentification; - if (ir != null) - formatIdentification = new FormatIdentification(ir.getName(), ir.getMimeType(), - ir.getPuid(), null); - else - formatIdentification = new FormatIdentification(translateTag(UNKNOWN), null, - translateTag(UNKNOWN), null); - formatInformationObjectEditor=createSEDAObjectEditor(formatIdentification, this); - ((SEDAObjectEditorCompositePanel) formatInformationObjectEditor.getSEDAObjectEditorPanel()).setExpanded(expanded); + if (ir != null) formatIdentification = new FormatIdentification( + ir.getName(), + ir.getMimeType(), + ir.getPuid(), + null + ); + else formatIdentification = new FormatIdentification( + translateTag(UNKNOWN), + null, + translateTag(UNKNOWN), + null + ); + formatInformationObjectEditor = createSEDAObjectEditor(formatIdentification, this); + ((SEDAObjectEditorCompositePanel) formatInformationObjectEditor.getSEDAObjectEditorPanel()).setExpanded( + expanded + ); replaceOrAddObjectEditor(formatInformationObjectEditor); expanded = false; - SEDAObjectEditor fileInfoObjectEditor= getSEDAObjectEditor("FileInfo"); - if (fileInfoObjectEditor != null) - expanded = ((SEDAObjectEditorCompositePanel) fileInfoObjectEditor.getSEDAObjectEditorPanel()).isExpanded(); + SEDAObjectEditor fileInfoObjectEditor = getSEDAObjectEditor("FileInfo"); + if (fileInfoObjectEditor != null) expanded = + ((SEDAObjectEditorCompositePanel) fileInfoObjectEditor.getSEDAObjectEditorPanel()).isExpanded(); FileInfo fileInfo = new FileInfo(); fileInfo.addNewMetadata("Filename", editedOnDiskPath.getFileName().toString()); - fileInfo.addNewMetadata("LastModified", LocalDateTimeUtil.getFormattedDateTime(Files.getLastModifiedTime(editedOnDiskPath))); + fileInfo.addNewMetadata( + "LastModified", + LocalDateTimeUtil.getFormattedDateTime(Files.getLastModifiedTime(editedOnDiskPath)) + ); fileInfoObjectEditor = createSEDAObjectEditor(fileInfo, this); ((SEDAObjectEditorCompositePanel) fileInfoObjectEditor.getSEDAObjectEditorPanel()).setExpanded(expanded); replaceOrAddObjectEditor(fileInfoObjectEditor); @@ -234,8 +254,11 @@ private void extractFileMetadataInEditors() { } private void defineButton() { - JFileChooser fileChooser = new JFileChooser((editedOnDiskPath == null ? Preferences.getInstance().getPrefsLoadDir() : - editedOnDiskPath.toAbsolutePath().getParent().toString())); + JFileChooser fileChooser = new JFileChooser( + (editedOnDiskPath == null + ? Preferences.getInstance().getPrefsLoadDir() + : editedOnDiskPath.toAbsolutePath().getParent().toString()) + ); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (fileChooser.showOpenDialog(ResipGraphicApp.getTheWindow()) == JFileChooser.APPROVE_OPTION) { @@ -245,15 +268,23 @@ private void defineButton() { openButton.setToolTipText(editedOnDiskPath.toAbsolutePath().toString()); String filename = null; - if (getSEDAObjectEditor("FileInfo") != null) - filename = ((ComplexListTypeEditor) getSEDAObjectEditor("FileInfo")).getComplexListTypeMetadata().getSimpleMetadata("Filename"); - if ((getSEDAObjectEditor("FileInfo") == null) || - (filename == null) || - filename.isEmpty() || - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Voulez-vous extraire automatiquement les informations de ce fichier?", - "Question", UserInteractionDialog.WARNING_DIALOG, - null) == OK_DIALOG) { + if (getSEDAObjectEditor("FileInfo") != null) filename = ((ComplexListTypeEditor) getSEDAObjectEditor( + "FileInfo" + )).getComplexListTypeMetadata() + .getSimpleMetadata("Filename"); + if ( + (getSEDAObjectEditor("FileInfo") == null) || + (filename == null) || + filename.isEmpty() || + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Voulez-vous extraire automatiquement les informations de ce fichier?", + "Question", + UserInteractionDialog.WARNING_DIALOG, + null + ) == + OK_DIALOG + ) { extractFileMetadataInEditors(); sedaObjectEditorPanel.revalidate(); @@ -272,9 +303,10 @@ private void defineButton() { public static BinaryDataObject createBinaryDataObjectSample(boolean minimal) throws SEDALibException { BinaryDataObject result = new BinaryDataObject(); - for (Map.Entry e: result.getMetadataMap().entrySet()) { - if (SEDAObjectEditorConstants.minimalTagList.contains(e.getKey())) - result.addMetadata(createSEDAMetadataSample(e.getValue().getMetadataClass().getName(),e.getKey(),minimal)); + for (Map.Entry e : result.getMetadataMap().entrySet()) { + if (SEDAObjectEditorConstants.minimalTagList.contains(e.getKey())) result.addMetadata( + createSEDAMetadataSample(e.getValue().getMetadataClass().getName(), e.getKey(), minimal) + ); } return result; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java index 39cb6aed..9fb8df17 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/ComplexListTypeEditor.java @@ -72,8 +72,9 @@ public class ComplexListTypeEditor extends CompositeEditor { */ public ComplexListTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); - if (!(metadata instanceof ComplexListType)) - throw new SEDALibException("La métadonnée à éditer n'est pas du bon type"); + if (!(metadata instanceof ComplexListType)) throw new SEDALibException( + "La métadonnée à éditer n'est pas du bon type" + ); } /** @@ -94,7 +95,8 @@ public ComplexListType getComplexListTypeMetadata() { * @return the seda editedObject sample * @throws SEDALibException the seda lib exception */ - public static SEDAMetadata getSEDAMetadataSample(Class complexListSubType, String elementName, boolean minimal) throws SEDALibException { + public static SEDAMetadata getSEDAMetadataSample(Class complexListSubType, String elementName, boolean minimal) + throws SEDALibException { ComplexListType result; try { result = (ComplexListType) complexListSubType.getConstructor().newInstance(); @@ -102,25 +104,42 @@ public static SEDAMetadata getSEDAMetadataSample(Class complexListSubType, St try { result = (ComplexListType) complexListSubType.getConstructor(String.class).newInstance(elementName); } catch (InstantiationException | IllegalAccessException | NoSuchMethodException e2) { - throw new SEDALibException("La création d'une métadonnée de type [" + complexListSubType + "] n'est pas possible", e2); + throw new SEDALibException( + "La création d'une métadonnée de type [" + complexListSubType + "] n'est pas possible", + e2 + ); } catch (InvocationTargetException te) { - throw new SEDALibException("La création d'une métadonnée de type [" + complexListSubType + "] a généré une erreur", te.getTargetException()); + throw new SEDALibException( + "La création d'une métadonnée de type [" + complexListSubType + "] a généré une erreur", + te.getTargetException() + ); } } catch (InvocationTargetException te) { - throw new SEDALibException("La création d'une métadonnée de type [" + complexListSubType + "] a généré une erreur", te.getTargetException()); + throw new SEDALibException( + "La création d'une métadonnée de type [" + complexListSubType + "] a généré une erreur", + te.getTargetException() + ); } result.elementName = elementName; for (String metadataName : result.getMetadataMap().keySet()) { if (!minimal || (SEDAObjectEditorConstants.minimalTagList.contains(metadataName))) { ComplexListMetadataKind complexListMetadataKind = result.getMetadataMap().get(metadataName); - SEDAMetadata metadataObject = SEDAObjectEditor.createSEDAMetadataSample(complexListMetadataKind.getMetadataClass().getSimpleName(), metadataName, minimal); + SEDAMetadata metadataObject = SEDAObjectEditor.createSEDAMetadataSample( + complexListMetadataKind.getMetadataClass().getSimpleName(), + metadataName, + minimal + ); try { result.addMetadata(metadataObject); } catch (SEDALibException ignored) { // no real case } if ((complexListMetadataKind.isMany()) && !minimal) { - metadataObject = SEDAObjectEditor.createSEDAMetadataSample(complexListMetadataKind.getMetadataClass().getSimpleName(), metadataName, minimal); + metadataObject = SEDAObjectEditor.createSEDAMetadataSample( + complexListMetadataKind.getMetadataClass().getSimpleName(), + metadataName, + minimal + ); try { result.addMetadata(metadataObject); } catch (SEDALibException ignored) { @@ -129,12 +148,14 @@ public static SEDAMetadata getSEDAMetadataSample(Class complexListSubType, St } } } - if (!result.isNotExpandable() && !minimal) - try { - result.addNewMetadata("AnyXMLType", "Text1Text2"); - } catch (SEDALibException ignored) { - // no real case - } + if (!result.isNotExpandable() && !minimal) try { + result.addNewMetadata( + "AnyXMLType", + "Text1Text2" + ); + } catch (SEDALibException ignored) { + // no real case + } return result; } @@ -148,7 +169,6 @@ public SEDAMetadata extractEditedObject() throws SEDALibException { return getComplexListTypeMetadata(); } - // Cut length for SEDAMetadata summary generation before expansion private static final int SUMMARY_CUT = 160; @@ -165,25 +185,21 @@ private String getSEDAMetadataSummary(SEDAMetadata sm, int depth, int length) { if (length > SUMMARY_CUT) break; } result = String.join(", ", summaryList) + (length > SUMMARY_CUT ? "..." : ""); - if (depth > 0) - result = "{" + result + "}"; + if (depth > 0) result = "{" + result + "}"; } else if ((sm instanceof NamedTypeMetadata)) { result = ((NamedTypeMetadata) sm).getValue().toString(); - } else - result = "?"; + } else result = "?"; return result; } @Override public String getSummary() throws SEDALibException { List summaryList = new ArrayList<>(objectEditorList.size()); - if (hasSubeditorsCreatedWhenExpandedFlag()) - return getSEDAMetadataSummary((SEDAMetadata) editedObject, 0, 0); + if (hasSubeditorsCreatedWhenExpandedFlag()) return getSEDAMetadataSummary((SEDAMetadata) editedObject, 0, 0); for (SEDAObjectEditor objectEditor : objectEditorList) { String summary = objectEditor.getSummary().trim(); if (!summary.isEmpty() && !summary.equals("{}")) { - if (objectEditor instanceof ComplexListTypeEditor) - summary = "{" + summary + "}"; + if (objectEditor instanceof ComplexListTypeEditor) summary = "{" + summary + "}"; summaryList.add(summary); } } @@ -212,12 +228,16 @@ public List> getExtensionList() throws SEDALibException { used.add(soe.getTag()); } for (String metadataName : getComplexListTypeMetadata().getMetadataMap().keySet()) { - ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata().getMetadataMap().get(metadataName); - if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) - result.add(Pair.of(metadataName, translateTag(metadataName))); + ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata() + .getMetadataMap() + .get(metadataName); + if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) result.add( + Pair.of(metadataName, translateTag(metadataName)) + ); } - if (!getComplexListTypeMetadata().isNotExpandable()) - result.add(Pair.of("AnyXMLType", translateTag("AnyXMLType"))); + if (!getComplexListTypeMetadata().isNotExpandable()) result.add( + Pair.of("AnyXMLType", translateTag("AnyXMLType")) + ); result.sort((p1, p2) -> p1.getValue().compareTo(p2.getValue())); return result; @@ -230,14 +250,16 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA boolean manyFlag; addOrderIndex = getComplexListTypeMetadata().indexOfMetadata(metadataName); i = 0; - if (addOrderIndex == -1) - return Integer.MAX_VALUE; + if (addOrderIndex == -1) return Integer.MAX_VALUE; else { manyFlag = getComplexListTypeMetadata().getMetadataMap().get(metadataName).isMany(); for (SEDAObjectEditor soe : objectEditorList) { curOrderIndex = getComplexListTypeMetadata().indexOfMetadata(soe.getTag()); - if ((!manyFlag) && (curOrderIndex == addOrderIndex) || - (curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) { + if ( + ((!manyFlag) && (curOrderIndex == addOrderIndex)) || + (curOrderIndex == -1) || + (curOrderIndex > addOrderIndex) + ) { break; } i++; @@ -249,30 +271,34 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA @Override public void addChild(String metadataName) throws SEDALibException { SEDAMetadata sedaMetadata = null; - if (!getComplexListTypeMetadata().isNotExpandable() && metadataName.equals("AnyXMLType")) - sedaMetadata = createSEDAMetadataSample("AnyXMLType", "AnyXMLType", true); + if (!getComplexListTypeMetadata().isNotExpandable() && metadataName.equals("AnyXMLType")) sedaMetadata = + createSEDAMetadataSample("AnyXMLType", "AnyXMLType", true); else { - ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata().getMetadataMap().get(metadataName); - if (complexListMetadataKind == null) - throw new SEDALibException("La sous-métadonnée [" + metadataName + "] n'existe pas dans la métadonnée [" + getTag() + "]"); - sedaMetadata = createSEDAMetadataSample(complexListMetadataKind.getMetadataClass().getSimpleName(), metadataName, true); + ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata() + .getMetadataMap() + .get(metadataName); + if (complexListMetadataKind == null) throw new SEDALibException( + "La sous-métadonnée [" + metadataName + "] n'existe pas dans la métadonnée [" + getTag() + "]" + ); + sedaMetadata = createSEDAMetadataSample( + complexListMetadataKind.getMetadataClass().getSimpleName(), + metadataName, + true + ); } if (sedaMetadata != null) { int insertionSEDAObjectEditorIndex = getInsertionSEDAObjectEditorIndex(metadataName); SEDAObjectEditor addedSEDAObjectEditor = createSEDAObjectEditor(sedaMetadata, this); - if (insertionSEDAObjectEditorIndex == Integer.MAX_VALUE) - objectEditorList.add(addedSEDAObjectEditor); - else - objectEditorList.add(insertionSEDAObjectEditorIndex, addedSEDAObjectEditor); + if (insertionSEDAObjectEditorIndex == Integer.MAX_VALUE) objectEditorList.add(addedSEDAObjectEditor); + else objectEditorList.add(insertionSEDAObjectEditorIndex, addedSEDAObjectEditor); ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).synchronizePanels(); } } @Override public boolean canContainsMultiple(String metadataName) throws SEDALibException { - if (getComplexListTypeMetadata().getMetadataMap().get(metadataName) == null) - return true; + if (getComplexListTypeMetadata().getMetadataMap().get(metadataName) == null) return true; return getComplexListTypeMetadata().getMetadataMap().get(metadataName).isMany(); } @@ -281,8 +307,7 @@ public boolean canContainsMultiple(String metadataName) throws SEDALibException */ @Override public boolean hasSubeditorsCreatedWhenExpandedFlag() { - if (((SEDAMetadata) getEditedObject()).getXmlElementName().contains("Document")) - return noSubEditors; + if (((SEDAMetadata) getEditedObject()).getXmlElementName().contains("Document")) return noSubEditors; return false; } @@ -295,15 +320,17 @@ public void createSubEditors() { for (SEDAMetadata detail : getComplexListTypeMetadata().getMetadataList()) { SEDAObjectEditor objectEditor = SEDAObjectEditor.createSEDAObjectEditor(detail, this); objectEditorList.add(objectEditor); - if (objectEditor instanceof CompositeEditor) - ((CompositeEditor) objectEditor).doExpand(false, false); + if (objectEditor instanceof CompositeEditor) ((CompositeEditor) objectEditor).doExpand(false, false); } ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).synchronizePanels(); } catch (SEDALibException e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Erreur fatale durant la création d'éditeur à la volée des structures\n" + - " -> " + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Erreur fatale durant la création d'éditeur à la volée des structures\n" + " -> " + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); } noSubEditors = false; } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java index 946d896d..f251528b 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/CompositeEditor.java @@ -96,7 +96,7 @@ public void removeChild(SEDAObjectEditor objectEditor) throws SEDALibException { /** * Refresh editedObject label. */ - public void refreshEditedObjectLabel() { + public void refreshEditedObjectLabel() { ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).refreshEditedObjectLabel(); } @@ -110,12 +110,11 @@ public void refreshEditedObjectLabel() { * @throws SEDALibException the seda lib exception */ public void doExpand(boolean extendedFlag, boolean innerFlag) throws SEDALibException { - if (sedaObjectEditorPanel == null) - createSEDAObjectEditorPanel(); + if (sedaObjectEditorPanel == null) createSEDAObjectEditorPanel(); ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).setExpanded(extendedFlag); - for (SEDAObjectEditor objectEditor : objectEditorList) - if (objectEditor instanceof CompositeEditor) - ((CompositeEditor) objectEditor).doExpand(innerFlag, innerFlag); + for (SEDAObjectEditor objectEditor : objectEditorList) if ( + objectEditor instanceof CompositeEditor + ) ((CompositeEditor) objectEditor).doExpand(innerFlag, innerFlag); } /** @@ -128,6 +127,5 @@ public boolean hasSubeditorsCreatedWhenExpandedFlag() { /** * Create sub editors. */ - public void createSubEditors() { - } + public void createSubEditors() {} } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java index d47fd1db..b26d79a0 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/DataObjectGroupEditor.java @@ -80,10 +80,15 @@ public String getTag() { @Override public String getName() { - return translateTag("DataObjectGroup") + " - " + - (editedObject == null ? translateTag("Unknown") : - (getDataObjectGroupMetadata().getInDataObjectPackageId() == null ? "Tbd" : - getDataObjectGroupMetadata().getInDataObjectPackageId())); + return ( + translateTag("DataObjectGroup") + + " - " + + (editedObject == null + ? translateTag("Unknown") + : (getDataObjectGroupMetadata().getInDataObjectPackageId() == null + ? "Tbd" + : getDataObjectGroupMetadata().getInDataObjectPackageId())) + ); } private void removeDataObject(DataObject dataObject) { @@ -93,10 +98,14 @@ private void removeDataObject(DataObject dataObject) { private void addDataObject(DataObject dataObject) throws SEDALibException { DataObjectGroup og; if (dataObject instanceof BinaryDataObject) { - getDataObjectGroupMetadata().getDataObjectPackage().addDataObjectPackageIdElement((BinaryDataObject) dataObject); + getDataObjectGroupMetadata() + .getDataObjectPackage() + .addDataObjectPackageIdElement((BinaryDataObject) dataObject); getDataObjectGroupMetadata().addDataObject((BinaryDataObject) dataObject); } else if (dataObject instanceof PhysicalDataObject) { - getDataObjectGroupMetadata().getDataObjectPackage().addDataObjectPackageIdElement((PhysicalDataObject) dataObject); + getDataObjectGroupMetadata() + .getDataObjectPackage() + .addDataObjectPackageIdElement((PhysicalDataObject) dataObject); getDataObjectGroupMetadata().addDataObject((PhysicalDataObject) dataObject); } } @@ -108,33 +117,30 @@ public DataObjectGroup extractEditedObject() throws SEDALibException { LogBook logBook = null; for (SEDAObjectEditor me : objectEditorList) { Object subObject = me.extractEditedObject(); - if (subObject instanceof BinaryDataObject) - bdoList.add((BinaryDataObject) subObject); - else if (subObject instanceof PhysicalDataObject) - pdoList.add((PhysicalDataObject) subObject); - else if (subObject instanceof LogBook) - logBook = (LogBook) subObject; + if (subObject instanceof BinaryDataObject) bdoList.add((BinaryDataObject) subObject); + else if (subObject instanceof PhysicalDataObject) pdoList.add((PhysicalDataObject) subObject); + else if (subObject instanceof LogBook) logBook = (LogBook) subObject; } getDataObjectGroupMetadata().setLogBook(logBook); - List previousBdoList = new ArrayList(getDataObjectGroupMetadata().getBinaryDataObjectList()); - for (BinaryDataObject bdo : previousBdoList) { - if (!bdoList.contains(bdo)) - removeDataObject(bdo); + List previousBdoList = new ArrayList( + getDataObjectGroupMetadata().getBinaryDataObjectList() + ); + for (BinaryDataObject bdo : previousBdoList) { + if (!bdoList.contains(bdo)) removeDataObject(bdo); } for (BinaryDataObject bdo : bdoList) { - if (!previousBdoList.contains(bdo)) - addDataObject(bdo); + if (!previousBdoList.contains(bdo)) addDataObject(bdo); } - List previousPdoList = new ArrayList(getDataObjectGroupMetadata().getPhysicalDataObjectList()); + List previousPdoList = new ArrayList( + getDataObjectGroupMetadata().getPhysicalDataObjectList() + ); for (PhysicalDataObject pdo : previousPdoList) { - if (!pdoList.contains(pdo)) - removeDataObject(pdo); + if (!pdoList.contains(pdo)) removeDataObject(pdo); } for (PhysicalDataObject pdo : pdoList) { - if (!previousPdoList.contains(pdo)) - addDataObject(pdo); + if (!previousPdoList.contains(pdo)) addDataObject(pdo); } return getDataObjectGroupMetadata(); @@ -161,7 +167,10 @@ private void renewObjectEditorList() throws SEDALibException { ((CompositeEditor) objectEditor).doExpand(false, false); } if (getDataObjectGroupMetadata().logBook != null) { - SEDAObjectEditor objectEditor = SEDAObjectEditor.createSEDAObjectEditor(getDataObjectGroupMetadata().logBook, this); + SEDAObjectEditor objectEditor = SEDAObjectEditor.createSEDAObjectEditor( + getDataObjectGroupMetadata().logBook, + this + ); objectEditorList.add(objectEditor); ((CompositeEditor) objectEditor).doExpand(false, false); } @@ -177,16 +186,19 @@ public void createSEDAObjectEditorPanel() throws SEDALibException { @Override public List> getExtensionList() { - if (getDataObjectGroupMetadata() == null) - return new ArrayList>(); + if (getDataObjectGroupMetadata() == null) return new ArrayList>(); - List> extensionList = new ArrayList>(Arrays.asList( + List> extensionList = new ArrayList>( + Arrays.asList( Pair.of("BinaryDataObject", translateTag("BinaryDataObject")), - Pair.of("PhysicalDataObject", translateTag("PhysicalDataObject")))); + Pair.of("PhysicalDataObject", translateTag("PhysicalDataObject")) + ) + ); - if ((objectEditorList.size()==0) || - (!objectEditorList.get(objectEditorList.size() - 1).getTag().equals("LogBook"))) - extensionList.add(Pair.of("LogBook", translateTag("LogBook"))); + if ( + (objectEditorList.size() == 0) || + (!objectEditorList.get(objectEditorList.size() - 1).getTag().equals("LogBook")) + ) extensionList.add(Pair.of("LogBook", translateTag("LogBook"))); return extensionList; } @@ -206,8 +218,7 @@ private int getInsertionIndex(String metadataName) { int addOrder = getOrder(metadataName); for (SEDAObjectEditor me : objectEditorList) { - if (getOrder(me.getTag()) > addOrder) - break; + if (getOrder(me.getTag()) > addOrder) break; index++; } return index; @@ -231,8 +242,9 @@ public void addChild(String editedObjectName) throws SEDALibException { addedObjectEditor = createSEDAObjectEditor((SEDAMetadata) metadata, this); break; } - if (metadata == null) - throw new SEDALibException("L'objet [" + editedObjectName + "] n'existe pas dans un DataObjectGroup"); + if (metadata == null) throw new SEDALibException( + "L'objet [" + editedObjectName + "] n'existe pas dans un DataObjectGroup" + ); objectEditorList.add(getInsertionIndex(editedObjectName), addedObjectEditor); ((CompositeEditor) addedObjectEditor).doExpand(true, false); ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).synchronizePanels(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java index e54a558b..0c9c87ef 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/PhysicalDataObjectEditor.java @@ -50,13 +50,11 @@ import java.util.List; import java.util.Map; - /** * The PhysicalDataObject object editor class. */ public class PhysicalDataObjectEditor extends AbstractUnitaryDataObjectEditor { - /** * Instantiates a new PhysicalDataObject editor. * @@ -81,17 +79,15 @@ public String getSummary() throws SEDALibException { List summaryList = new ArrayList<>(objectEditorList.size()); String tmp; for (SEDAMetadata sm : getPhysicalDataObject().getMetadataList()) { - if (sm instanceof StringType) - summaryList.add(((StringType) sm).getValue()); - else if (sm instanceof PersistentIdentifier) - summaryList.add(((PersistentIdentifier) sm).getSummary()); + if (sm instanceof StringType) summaryList.add(((StringType) sm).getValue()); + else if (sm instanceof PersistentIdentifier) summaryList.add(((PersistentIdentifier) sm).getSummary()); } return String.join(", ", summaryList); } @Override public void createSEDAObjectEditorPanel() throws SEDALibException { - prepareSEDAObjectEditorPanel(null ); + prepareSEDAObjectEditorPanel(null); } /** @@ -105,8 +101,9 @@ public static PhysicalDataObject createPhysicalDataObjectSample(boolean minimal) PhysicalDataObject result = new PhysicalDataObject(); for (Map.Entry e : result.getMetadataMap().entrySet()) { - if (SEDAObjectEditorConstants.minimalTagList.contains(e.getKey())) - result.addMetadata(createSEDAMetadataSample(e.getValue().getMetadataClass().getName(), e.getKey(), minimal)); + if (SEDAObjectEditorConstants.minimalTagList.contains(e.getKey())) result.addMetadata( + createSEDAMetadataSample(e.getValue().getMetadataClass().getName(), e.getKey(), minimal) + ); } return result; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java index 6d208c62..34f9e075 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/composite/RuleTypeEditor.java @@ -55,18 +55,17 @@ import static java.util.Map.Entry.comparingByValue; public class RuleTypeEditor extends ComplexListTypeEditor { + public RuleTypeEditor(SEDAMetadata metadata, SEDAObjectEditor father) throws SEDALibException { super(metadata, father); } @Override protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDALibException { - if(metadataName.equals(RULE_TAG)) - return getNewRuleIndex(); + if (metadataName.equals(RULE_TAG)) return getNewRuleIndex(); int addOrderIndex = getComplexListTypeMetadata().indexOfMetadata(metadataName); int i = 0; - if (addOrderIndex == -1) - return Integer.MAX_VALUE; + if (addOrderIndex == -1) return Integer.MAX_VALUE; else { boolean manyFlag = getComplexListTypeMetadata().getMetadataMap().get(metadataName).isMany(); for (SEDAObjectEditor soe : objectEditorList) { @@ -74,8 +73,7 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA if ((!manyFlag) && (curOrderIndex == addOrderIndex)) { break; } - if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) - break; + if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) break; i++; } } @@ -84,54 +82,59 @@ protected int getInsertionSEDAObjectEditorIndex(String metadataName) throws SEDA private int getNewRuleIndex() throws SEDALibException { List ruleMetadataKindList = ((RuleType) editedObject).getRuleMetadataKindList(); - for(int i = objectEditorList.size()-1; i >= 0; i--) { - String elementName = ((NamedTypeMetadata) objectEditorList.get(i).getEditedObject()).getXmlElementName(); - if(elementName.equals(RULE_TAG) || ruleMetadataKindList.contains(elementName)) - return i+1; - } + for (int i = objectEditorList.size() - 1; i >= 0; i--) { + String elementName = ((NamedTypeMetadata) objectEditorList.get(i).getEditedObject()).getXmlElementName(); + if (elementName.equals(RULE_TAG) || ruleMetadataKindList.contains(elementName)) return i + 1; + } return 0; } public void addChildTo(String metadataName, Rule ruleParent) throws SEDALibException { SEDAMetadata sedaMetadata; - if (!getComplexListTypeMetadata().isNotExpandable() && metadataName.equals("AnyXMLType")) - sedaMetadata = createSEDAMetadataSample("AnyXMLType", "AnyXMLType", true); + if (!getComplexListTypeMetadata().isNotExpandable() && metadataName.equals("AnyXMLType")) sedaMetadata = + createSEDAMetadataSample("AnyXMLType", "AnyXMLType", true); else { - ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata().getMetadataMap().get(metadataName); - if (complexListMetadataKind == null) - throw new SEDALibException("La sous-métadonnée [" + metadataName + "] n'existe pas dans la métadonnée [" + getTag() + "]"); - sedaMetadata = createSEDAMetadataSample(complexListMetadataKind.getMetadataClass().getSimpleName(), metadataName, true); + ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata() + .getMetadataMap() + .get(metadataName); + if (complexListMetadataKind == null) throw new SEDALibException( + "La sous-métadonnée [" + metadataName + "] n'existe pas dans la métadonnée [" + getTag() + "]" + ); + sedaMetadata = createSEDAMetadataSample( + complexListMetadataKind.getMetadataClass().getSimpleName(), + metadataName, + true + ); } if (sedaMetadata != null) { int insertionSEDAObjectEditorIndex = getInsertionSEDAObjectEditorIndex(metadataName, ruleParent); SEDAObjectEditor addedSEDAObjectEditor = createSEDAObjectEditor(sedaMetadata, this); - if (insertionSEDAObjectEditorIndex == Integer.MAX_VALUE) - objectEditorList.add(addedSEDAObjectEditor); - else - objectEditorList.add(insertionSEDAObjectEditorIndex, addedSEDAObjectEditor); + if (insertionSEDAObjectEditorIndex == Integer.MAX_VALUE) objectEditorList.add(addedSEDAObjectEditor); + else objectEditorList.add(insertionSEDAObjectEditorIndex, addedSEDAObjectEditor); ((SEDAObjectEditorCompositePanel) sedaObjectEditorPanel).synchronizePanels(); } } private int getInsertionSEDAObjectEditorIndex(String metadataName, Rule ruleParent) throws SEDALibException { int addOrderIndex = getComplexListTypeMetadata().indexOfMetadata(metadataName); - int parentIndex = objectEditorList.stream().map(SEDAObjectEditor::getEditedObject).collect(Collectors.toList()).indexOf(ruleParent); - if(parentIndex == -1) - throw new IllegalStateException("Cannot find parent element"); + int parentIndex = objectEditorList + .stream() + .map(SEDAObjectEditor::getEditedObject) + .collect(Collectors.toList()) + .indexOf(ruleParent); + if (parentIndex == -1) throw new IllegalStateException("Cannot find parent element"); int i = 1; // first position for RuleId - if (addOrderIndex == -1) - return Integer.MAX_VALUE; + if (addOrderIndex == -1) return Integer.MAX_VALUE; else { boolean manyFlag = getComplexListTypeMetadata().getMetadataMap().get(metadataName).isMany(); for (SEDAObjectEditor soe : objectEditorList.subList(parentIndex + 1, objectEditorList.size())) { - if(soe.getTag().equals("Rule")) break; + if (soe.getTag().equals("Rule")) break; int curOrderIndex = getComplexListTypeMetadata().indexOfMetadata(soe.getTag()); if ((!manyFlag) && (curOrderIndex == addOrderIndex)) { break; } - if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) - break; + if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) break; i++; } } @@ -145,16 +148,24 @@ public List> getExtensionList() throws SEDALibException { for (SEDAObjectEditor soe : objectEditorList) { used.add(soe.getTag()); } - List metadataOrderedList = getComplexListTypeMetadata().getMetadataMap().entrySet().stream().filter(e -> !(e.getValue() instanceof RuleMetadataKind)).map( - Map.Entry::getKey).collect( - Collectors.toList()); + List metadataOrderedList = getComplexListTypeMetadata() + .getMetadataMap() + .entrySet() + .stream() + .filter(e -> !(e.getValue() instanceof RuleMetadataKind)) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); for (String metadataName : metadataOrderedList) { - ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata().getMetadataMap().get(metadataName); - if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) - result.add(Pair.of(metadataName, translateTag(metadataName))); + ComplexListMetadataKind complexListMetadataKind = getComplexListTypeMetadata() + .getMetadataMap() + .get(metadataName); + if ((complexListMetadataKind.isMany()) || (!used.contains(metadataName))) result.add( + Pair.of(metadataName, translateTag(metadataName)) + ); } - if (!getComplexListTypeMetadata().isNotExpandable()) - result.add(Pair.of("AnyXMLType", translateTag("AnyXMLType"))); + if (!getComplexListTypeMetadata().isNotExpandable()) result.add( + Pair.of("AnyXMLType", translateTag("AnyXMLType")) + ); result.sort(comparingByValue()); return result; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java index ba7ded6a..85c4f9a6 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/AddThread.java @@ -66,6 +66,7 @@ * The type Add thread. */ public class AddThread extends SwingWorker { + //input private Work work; private DataObjectPackageTreeNode targetNode; @@ -89,14 +90,22 @@ public static void launchAddThread(List files, TreePath targetPath) { try { InOutDialog inOutDialog = new InOutDialog(ResipGraphicApp.getTheWindow(), "Import"); - addThread = new AddThread(ResipGraphicApp.getTheApp().currentWork, (targetPath == null ? null : - (DataObjectPackageTreeNode) targetPath.getLastPathComponent()), files, inOutDialog); + addThread = new AddThread( + ResipGraphicApp.getTheApp().currentWork, + (targetPath == null ? null : (DataObjectPackageTreeNode) targetPath.getLastPathComponent()), + files, + inOutDialog + ); addThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheWindow(), - "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheWindow(), + "Erreur fatale, impossible de faire l'import \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de faire l'import", e); } } @@ -109,19 +118,13 @@ public static void launchAddThread(List files, TreePath targetPath) { * @param files the files * @param dialog the dialog */ - public AddThread(Work work, DataObjectPackageTreeNode targetNode, List files, - InOutDialog dialog) { - if (targetNode != null) - this.work = work; - else - this.work = new Work(null, - new DiskImportContext(Preferences.getInstance()), - null); + public AddThread(Work work, DataObjectPackageTreeNode targetNode, List files, InOutDialog dialog) { + if (targetNode != null) this.work = work; + else this.work = new Work(null, new DiskImportContext(Preferences.getInstance()), null); this.targetNode = targetNode; this.lp = new ArrayList<>(); - for (File f : files) - lp.add(f.toPath()); + for (File f : files) lp.add(f.toPath()); this.inOutDialog = dialog; this.summary = null; this.exitThrowable = null; @@ -131,9 +134,9 @@ public AddThread(Work work, DataObjectPackageTreeNode targetNode, List fil private void setWorkFromDataObjectPackage(DataObjectPackage dataObjectPackage) { work.setDataObjectPackage(dataObjectPackage); ExportContext newExportContext = new ExportContext(Preferences.getInstance()); - if (dataObjectPackage.getManagementMetadataXmlData() != null) - newExportContext.setManagementMetadataXmlData( - dataObjectPackage.getManagementMetadataXmlData()); + if (dataObjectPackage.getManagementMetadataXmlData() != null) newExportContext.setManagementMetadataXmlData( + dataObjectPackage.getManagementMetadataXmlData() + ); work.setExportContext(newExportContext); } @@ -160,21 +163,27 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); DiskImportContext dic; - if (this.work.getCreationContext() instanceof DiskImportContext) - dic = (DiskImportContext) this.work.getCreationContext(); - else - dic = new DiskImportContext(Preferences.getInstance()); + if (this.work.getCreationContext() instanceof DiskImportContext) dic = + (DiskImportContext) this.work.getCreationContext(); + else dic = new DiskImportContext(Preferences.getInstance()); di = new DiskToDataObjectPackageImporter(lp, dic.isNoLinkFlag(), null, spl); - for (String ip : dic.getIgnorePatternList()) - di.addIgnorePattern(ip); + for (String ip : dic.getIgnorePatternList()) di.addIgnorePattern(ip); di.doImport(); summary = di.getSummary(); } catch (Throwable e) { @@ -188,10 +197,18 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Ajout annulé, les données n'ont pas été modifiées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant l'ajout, les données n'ont pas été modifiées", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Ajout annulé, les données n'ont pas été modifiées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant l'ajout, les données n'ont pas été modifiées", + exitThrowable + ); else if (targetNode == null) { ((DiskImportContext) work.getCreationContext()).setModelVersion(di.getModelVersion()); setWorkFromDataObjectPackage(di.getDataObjectPackage()); @@ -206,9 +223,15 @@ else if (targetNode == null) { doProgressLogWithoutInterruption(spl, GLOBAL, summary, null); } else { ResipGraphicApp.getTheApp().currentWork = this.work; - List addedNodes = di.getDataObjectPackage().getGhostRootAu().getChildrenAuList() - .getArchiveUnitList(); - targetNode.getArchiveUnit().getDataObjectPackage().moveContentFromDataObjectPackage(di.getDataObjectPackage(), targetNode.getArchiveUnit()); + List addedNodes = di + .getDataObjectPackage() + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList(); + targetNode + .getArchiveUnit() + .getDataObjectPackage() + .moveContentFromDataObjectPackage(di.getDataObjectPackage(), targetNode.getArchiveUnit()); DataObjectPackageTreeModel treeModel = targetNode.getTreeModel(); int auRecursivCount = 0; int ogRecursivCount = 0; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java index 38f00304..f5f474c8 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ChangeSeda2VersionThread.java @@ -56,6 +56,7 @@ * The change SEDA2 version thread. */ public class ChangeSeda2VersionThread extends SwingWorker { + //input private final SedaVersion currentVersion; private final SedaVersion nextVersion; @@ -104,15 +105,22 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - if (work == null) - throw new ResipException("Pas de contenu à transformer"); + if (work == null) throw new ResipException("Pas de contenu à transformer"); convertedDop = new SedaVersionConverter(spl).convert(dop, currentVersion, nextVersion); } catch (Throwable e) { //NOSONAR @@ -126,12 +134,14 @@ protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: conversion annulée", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant la conversion", exitThrowable); - else - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: conversion OK", null); + if (isCancelled()) doProgressLogWithoutInterruption(spl, GLOBAL, "resip: conversion annulée", null); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant la conversion", + exitThrowable + ); + else doProgressLogWithoutInterruption(spl, GLOBAL, "resip: conversion OK", null); } public DataObjectPackage getResult() { diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java index 2baaf50e..880a5cc0 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckEndDateThread.java @@ -57,7 +57,8 @@ import static fr.gouv.vitam.tools.sedalib.utils.SEDALibProgressLogger.GLOBAL; import static fr.gouv.vitam.tools.sedalib.utils.SEDALibProgressLogger.doProgressLogWithoutInterruption; -public class CheckEndDateThread extends SwingWorker { +public class CheckEndDateThread extends SwingWorker { + private final VerifyDateDialog verifyDateDialog; //run output private Throwable exitThrowable; @@ -90,15 +91,22 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = verifyDateDialog.getExtProgressTextArea().getText() + "\n" + log; - verifyDateDialog.getExtProgressTextArea().setText(newLog); - verifyDateDialog.getExtProgressTextArea().setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = verifyDateDialog.getExtProgressTextArea().getText() + "\n" + log; + verifyDateDialog.getExtProgressTextArea().setText(newLog); + verifyDateDialog.getExtProgressTextArea().setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - if (work == null) - throw new ResipException("Pas de contenu à valider"); + if (work == null) throw new ResipException("Pas de contenu à valider"); // first verify and reindex if neccesary if (work.getExportContext().isReindex()) { @@ -106,9 +114,9 @@ public String doInBackground() { ResipGraphicApp.mainWindow.treePane.allTreeChanged(); } - - HashMap auInDataObjectPackageIdMap = - work.getDataObjectPackage().getAuInDataObjectPackageIdMap(); + HashMap auInDataObjectPackageIdMap = work + .getDataObjectPackage() + .getAuInDataObjectPackageIdMap(); List searchArchiveUnitResult = new ArrayList<>(); boolean isError = false; @@ -116,14 +124,20 @@ public String doInBackground() { ArchiveUnit archiveUnit = entry.getValue(); String startDateString = archiveUnit.getContent().getSimpleMetadata("StartDate"); String endDateString = archiveUnit.getContent().getSimpleMetadata("EndDate"); - if(endDateString != null && startDateString != null) { + if (endDateString != null && startDateString != null) { Date startDate = ISODateTimeFormat.dateTimeParser().parseDateTime(startDateString).toDate(); Date endDate = ISODateTimeFormat.dateTimeParser().parseDateTime(endDateString).toDate(); if (startDate.after(endDate)) { searchArchiveUnitResult.add(archiveUnit); - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: l'unité archivistique " + entry.getKey() + - " contient une erreur : la date de fin est antérieure à la date de début", null); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: l'unité archivistique " + + entry.getKey() + + " contient une erreur : la date de fin est antérieure à la date de début", + null + ); isError = true; } } @@ -140,11 +154,13 @@ public String doInBackground() { @Override protected void done() { - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation annulée", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant la validation", exitThrowable); - else - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation OK", null); + if (isCancelled()) doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation annulée", null); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant la validation", + exitThrowable + ); + else doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation OK", null); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java index defedbd2..803c9e75 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CheckProfileThread.java @@ -54,6 +54,7 @@ * The type Check profile thread. */ public class CheckProfileThread extends SwingWorker { + //input private String profileFileName; private InOutDialog inOutDialog; @@ -89,15 +90,22 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - if (work == null) - throw new ResipException("Pas de contenu à valider"); + if (work == null) throw new ResipException("Pas de contenu à valider"); // first verify and reindex if neccesary if (work.getExportContext().isReindex()) { @@ -106,7 +114,9 @@ public String doInBackground() { } ArchiveTransfer archiveTransfer = new ArchiveTransfer(); - work.getDataObjectPackage().setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); + work + .getDataObjectPackage() + .setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); archiveTransfer.setDataObjectPackage(work.getDataObjectPackage()); archiveTransfer.setGlobalMetadata(work.getExportContext().getArchiveTransferGlobalMetadata()); @@ -115,7 +125,7 @@ public String doInBackground() { } else { archiveTransfer.sedaProfileValidate(profileFileName, spl); } - } catch (Throwable e) {//NOSONAR + } catch (Throwable e) { //NOSONAR exitThrowable = e; } return "OK"; @@ -125,11 +135,13 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation annulée", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant la validation", exitThrowable); - else - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation OK", null); + if (isCancelled()) doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation annulée", null); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant la validation", + exitThrowable + ); + else doProgressLogWithoutInterruption(spl, GLOBAL, "resip: validation OK", null); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java index 3a9e9a83..b0e59043 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CleanThread.java @@ -76,8 +76,7 @@ public CleanThread(String workDir, InOutDialog dialog) { private void recursiveDelete(File inFile) throws IOException, InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); } else { inFile.delete(); @@ -99,11 +98,19 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2, SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); doProgressLog(spl, GLOBAL, "Nettoyage du répertoire: " + workDir, null); for (File f : new File(workDir).listFiles()) { @@ -126,12 +133,18 @@ protected void done() { JTextArea loadText = inOutDialog.extProgressTextArea; inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Nettoyage annulé, les fichiers sont partiellement effacées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant le nettoyage du " + - "répertoire de travail, les fichiers sont partiellement effacés", exitThrowable); - else - doProgressLogWithoutInterruption(spl, GLOBAL, "Nettoyage terminé", null); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Nettoyage annulé, les fichiers sont partiellement effacées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant le nettoyage du " + "répertoire de travail, les fichiers sont partiellement effacés", + exitThrowable + ); + else doProgressLogWithoutInterruption(spl, GLOBAL, "Nettoyage terminé", null); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java index 828aeaf4..ae113f51 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/CompactThread.java @@ -66,6 +66,7 @@ * The type Compact thread. */ public class CompactThread extends SwingWorker { + //input private final Work work; private final DataObjectPackageTreeNode targetNode; @@ -91,12 +92,15 @@ public static void launchCompactThread(DataObjectPackageTreeNode node) { compactThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.mainWindow, - "Erreur fatale, impossible de faire le compactage \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.mainWindow, + "Erreur fatale, impossible de faire le compactage \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de faire le compactage", e); } - } /** @@ -117,17 +121,22 @@ public CompactThread(Work work, DataObjectPackageTreeNode targetNode, InOutDialo private void recursiveDelete(File inFile) throws InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); } else { inFile.delete(); fileCounter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, fileCounter, fileCounter + " fichiers effacés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + fileCounter, + fileCounter + " fichiers effacés" + ); } } - private String getTmpDirTarget(String workDir, String srcPathName, String id) throws ResipException, InterruptedException { + private String getTmpDirTarget(String workDir, String srcPathName, String id) + throws ResipException, InterruptedException { String subDir = Paths.get(srcPathName).getFileName().toString() + "-" + id + "-tmpdir"; String target = workDir + File.separator + subDir; if (Files.exists(Paths.get(target))) { @@ -140,7 +149,7 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th target = utdd.getResult(); } else if ((utdd.getReturnValue() == STATUS_CONTINUE) || (utdd.getReturnValue() == STATUS_CHANGE)) { target = utdd.getResult(); - } else {// STATUS_CANCEL + } else { // STATUS_CANCEL this.cancel(false); throw new ResipException("Opération annulée"); } @@ -151,10 +160,8 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th private Map getContentMetadataFilter(CompactContext coc) { Map contentMetadataFilter = new HashMap<>(); for (String m : coc.getKeptMetadataList()) { - if (m.trim().isEmpty()) - continue; - else if (!m.contains(":")) - contentMetadataFilter.put(m.trim(), 0); + if (m.trim().isEmpty()) continue; + else if (!m.contains(":")) contentMetadataFilter.put(m.trim(), 0); else { int tmp = 0; try { @@ -162,8 +169,7 @@ else if (!m.contains(":")) } catch (NumberFormatException ignored) { // no real case } - if (tmp < 0) - tmp = 0; + if (tmp < 0) tmp = 0; contentMetadataFilter.put(m.substring(0, m.indexOf(":")).trim(), tmp); } } @@ -192,16 +198,31 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); ArchiveUnit targetArchiveUnit = targetNode.getArchiveUnit(); - doProgressLog(spl, GLOBAL, "Compactage de l'ArchiveUnit [" + targetArchiveUnit.getInDataObjectPackageId() + "]=" + - targetArchiveUnit.getContent().getSimpleMetadata("Title"), null); + doProgressLog( + spl, + GLOBAL, + "Compactage de l'ArchiveUnit [" + + targetArchiveUnit.getInDataObjectPackageId() + + "]=" + + targetArchiveUnit.getContent().getSimpleMetadata("Title"), + null + ); CompactContext coc = new CompactContext(Preferences.getInstance()); @@ -209,9 +230,11 @@ public String doInBackground() { //run output Compactor compactor = new Compactor(targetArchiveUnit, target, spl); compactor.setCompactedDocumentPackLimit(coc.getMaxMetadataSize(), coc.getMaxDocumentNumber()); - compactor.setObjectVersionFilters(coc.getDocumentKeptDataObjectVersionList(), coc.getSubDocumentKeptDataObjectVersionList()); - if (!coc.isMetadataFilterFlag()) - compactor.setMetadataFilters(null, null); + compactor.setObjectVersionFilters( + coc.getDocumentKeptDataObjectVersionList(), + coc.getSubDocumentKeptDataObjectVersionList() + ); + if (!coc.isMetadataFilterFlag()) compactor.setMetadataFilters(null, null); else { Map contentMetadataFilter = getContentMetadataFilter(coc); compactor.setMetadataFilters(contentMetadataFilter, contentMetadataFilter); @@ -231,10 +254,18 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Compactage annulé, les données n'ont pas été modifiées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant le compactage, les données n'ont pas été modifiées", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Compactage annulé, les données n'ont pas été modifiées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant le compactage, les données n'ont pas été modifiées", + exitThrowable + ); else { ResipGraphicApp.getTheApp().currentWork = this.work; @@ -245,8 +276,7 @@ else if (exitThrowable != null) newNode = targetNode.getTreeModel().generateArchiveUnitNode(compactedArchiveUnit, targetNodeParent); } - if (newNode!=null) - newNode.getTreeModel().nodeStructureChanged(newNode.getParent()); + if (newNode != null) newNode.getTreeModel().nodeStructureChanged(newNode.getParent()); work.getCreationContext().setStructureChanged(true); ResipGraphicApp.getTheApp().setModifiedContext(true); ResipGraphicApp.mainWindow.treePane.reset(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java index bbf28b00..fe3dce4d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DeCompactThread.java @@ -67,6 +67,7 @@ * The type Compact thread. */ public class DeCompactThread extends SwingWorker { + //input private final Work work; private final DataObjectPackageTreeNode targetNode; @@ -92,12 +93,16 @@ public static void launchDeCompactThread(DataObjectPackageTreeNode node) { compactThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.mainWindow, - "Erreur fatale, impossible de faire le décompactage \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de faire le décompactage", e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.mainWindow, + "Erreur fatale, impossible de faire le décompactage \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log(ResipLogger.ERROR, "Erreur fatale, impossible de faire le décompactage", e); } - } /** @@ -118,17 +123,22 @@ public DeCompactThread(Work work, DataObjectPackageTreeNode targetNode, InOutDia private void recursiveDelete(File inFile) throws InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); } else { inFile.delete(); fileCounter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, fileCounter, fileCounter + " fichiers effacés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + fileCounter, + fileCounter + " fichiers effacés" + ); } } - private String getTmpDirTarget(String workDir, String srcPathName, String id) throws ResipException, InterruptedException { + private String getTmpDirTarget(String workDir, String srcPathName, String id) + throws ResipException, InterruptedException { String subDir = Paths.get(srcPathName).getFileName().toString() + "-" + id + "-tmpdir"; String target = workDir + File.separator + subDir; if (Files.exists(Paths.get(target))) { @@ -141,7 +151,7 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th target = utdd.getResult(); } else if ((utdd.getReturnValue() == STATUS_CONTINUE) || (utdd.getReturnValue() == STATUS_CHANGE)) { target = utdd.getResult(); - } else {// STATUS_CANCEL + } else { // STATUS_CANCEL this.cancel(false); throw new ResipException("Opération annulée"); } @@ -152,10 +162,8 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th private Map getContentMetadataFilter(CompactContext coc) { Map contentMetadataFilter = new HashMap<>(); for (String m : coc.getKeptMetadataList()) { - if (m.trim().isEmpty()) - continue; - else if (!m.contains(":")) - contentMetadataFilter.put(m.trim(), 0); + if (m.trim().isEmpty()) continue; + else if (!m.contains(":")) contentMetadataFilter.put(m.trim(), 0); else { int tmp = 0; try { @@ -163,8 +171,7 @@ else if (!m.contains(":")) } catch (NumberFormatException ignored) { // no real case } - if (tmp < 0) - tmp = 0; + if (tmp < 0) tmp = 0; contentMetadataFilter.put(m.substring(0, m.indexOf(":")).trim(), tmp); } } @@ -193,16 +200,31 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); ArchiveUnit targetArchiveUnit = targetNode.getArchiveUnit(); - doProgressLog(spl, GLOBAL, "Décompactage de l'ArchiveUnit [" + targetArchiveUnit.getInDataObjectPackageId() + "]=" + - targetArchiveUnit.getContent().getSimpleMetadata("Title"), null); + doProgressLog( + spl, + GLOBAL, + "Décompactage de l'ArchiveUnit [" + + targetArchiveUnit.getInDataObjectPackageId() + + "]=" + + targetArchiveUnit.getContent().getSimpleMetadata("Title"), + null + ); CreationContext cc = new CreationContext(Preferences.getInstance()); @@ -223,10 +245,18 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Décompactage annulé, les données n'ont pas été modifiées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant le décompactage, les données n'ont pas été modifiées", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Décompactage annulé, les données n'ont pas été modifiées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant le décompactage, les données n'ont pas été modifiées", + exitThrowable + ); else { ResipGraphicApp.getTheApp().currentWork = this.work; @@ -237,8 +267,7 @@ else if (exitThrowable != null) newNode = targetNode.getTreeModel().generateArchiveUnitNode(decompactedArchiveUnit, targetNodeParent); } - if (newNode!=null) - newNode.getTreeModel().nodeStructureChanged(newNode.getParent()); + if (newNode != null) newNode.getTreeModel().nodeStructureChanged(newNode.getParent()); work.getCreationContext().setStructureChanged(true); ResipGraphicApp.getTheApp().setModifiedContext(true); ResipGraphicApp.mainWindow.treePane.reset(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java index d2a61da6..1fdffb25 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/DuplicatesThread.java @@ -76,7 +76,7 @@ public class DuplicatesThread extends SwingWorker { /** * The Exit exception. */ -//run output + //run output private Throwable exitThrowable; /** @@ -92,8 +92,12 @@ public class DuplicatesThread extends SwingWorker { * @param binaryFilename the binary filename * @param physicalAllMD the physical all md */ - public DuplicatesThread(DuplicatesWindow duplicatesWindow, boolean binaryHash, boolean binaryFilename, - boolean physicalAllMD) { + public DuplicatesThread( + DuplicatesWindow duplicatesWindow, + boolean binaryHash, + boolean binaryFilename, + boolean physicalAllMD + ) { this.duplicatesWindow = duplicatesWindow; this.binaryHash = binaryHash; this.binaryFilename = binaryFilename; @@ -111,8 +115,7 @@ void followTree(ArchiveUnit au, HashMap> dogByDogD List auList = au.getChildrenAuList().getArchiveUnitList(); for (ArchiveUnit childUnit : auList) { - if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) - continue; + if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) continue; for (DataObject dataObject : childUnit.getDataObjectRefList().getDataObjectList()) { if (dataObject instanceof DataObjectGroup) { String dogKey = dogKeyMap.get(dataObject); @@ -120,8 +123,9 @@ void followTree(ArchiveUnit au, HashMap> dogByDogD dogByDogDigestMap.get(dogKey).remove(dataObject); sortedDogByDogDigestMap.get(dogKey).add((DataObjectGroup) dataObject); sortedAuByDogDigestMap.get(dogKey).add(childUnit); - } else if (sortedDogByDogDigestMap.get(dogKey).contains(dataObject)) - sortedAuByDogDigestMap.get(dogKey).add(childUnit); + } else if (sortedDogByDogDigestMap.get(dogKey).contains(dataObject)) sortedAuByDogDigestMap + .get(dogKey) + .add(childUnit); } } dataObjectPackage.addTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId()); @@ -129,7 +133,9 @@ void followTree(ArchiveUnit au, HashMap> dogByDogD } } - private LinkedHashMap> treeSort(HashMap> dogByDogDigestMap) { + private LinkedHashMap> treeSort( + HashMap> dogByDogDigestMap + ) { dataObjectPackage.resetTouchedInDataObjectPackageIdMap(); sortedDogByDogDigestMap = new LinkedHashMap>(); sortedAuByDogDigestMap = new HashMap>(); @@ -154,52 +160,76 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, null, - localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + null, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); dataObjectPackage = ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage(); - doProgressLog(spl, GLOBAL, "resip: recherche de doublons ( " + (binaryHash ? "hachage de fichier " : "") + - (binaryFilename ? "nom de fichier " : "") + (physicalAllMD ? "toute MD physique " : "") + ")", null); + doProgressLog( + spl, + GLOBAL, + "resip: recherche de doublons ( " + + (binaryHash ? "hachage de fichier " : "") + + (binaryFilename ? "nom de fichier " : "") + + (physicalAllMD ? "toute MD physique " : "") + + ")", + null + ); HashMap> dogByDigestMap = new HashMap>(); dogKeyMap = new HashMap(); for (DataObjectGroup dog : dataObjectPackage.getDogInDataObjectPackageIdMap().values()) { tmp = (dog.logBook == null ? "" : dog.logBook.toString()); for (BinaryDataObject bdo : dog.getBinaryDataObjectList()) { if (binaryHash) { - DigestType md=bdo.getMetadataMessageDigest(); + DigestType md = bdo.getMetadataMessageDigest(); tmp += "|BDO=" + (md == null ? null : md.getValue()); } if (binaryFilename) { - FileInfo fi=bdo.getMetadataFileInfo(); + FileInfo fi = bdo.getMetadataFileInfo(); tmp += "|" + (fi == null ? null : fi.getSimpleMetadata("Filename")); } } for (PhysicalDataObject pdo : dog.getPhysicalDataObjectList()) { - if (physicalAllMD) - tmp += "|PDO=" + pdo.toSedaXmlFragments(); + if (physicalAllMD) tmp += "|PDO=" + pdo.toSedaXmlFragments(); } dogKeyMap.put(dog, tmp); if (dogByDigestMap.get(tmp) == null) { ArrayList dogList = new ArrayList(); dogList.add(dog); dogByDigestMap.put(tmp, dogList); - } else - dogByDigestMap.get(tmp).add(dog); + } else dogByDigestMap.get(tmp).add(dog); counter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS, counter, "resip: " + - counter + " groupes d'objets comparés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS, + counter, + "resip: " + counter + " groupes d'objets comparés" + ); } dogByDigestMap = treeSort(dogByDigestMap); - for (Iterator>> it = sortedAuByDogDigestMap.entrySet().iterator(); it.hasNext(); ) { + for ( + Iterator>> it = sortedAuByDogDigestMap.entrySet().iterator(); + it.hasNext(); + ) { Map.Entry> entry = it.next(); if (entry.getValue().size() == 1) { it.remove(); dogByDigestMap.remove(entry.getKey()); } } - doProgressLog(spl, GLOBAL, - "resip: " + dogByDigestMap.size() + " lots de groupes d'objets semblables", null); + doProgressLog( + spl, + GLOBAL, + "resip: " + dogByDigestMap.size() + " lots de groupes d'objets semblables", + null + ); } catch (Throwable e) { exitThrowable = e; return "KO"; @@ -215,7 +245,12 @@ protected void done() { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: recherche de doublons annulée", null); duplicatesWindow.setBlankDuplicatesResult(); } else if (exitThrowable != null) { - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant la recherche de doublons", exitThrowable); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant la recherche de doublons", + exitThrowable + ); duplicatesWindow.setBlankDuplicatesResult(); } else { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: recherche de doublons terminée", null); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java index 87e4c604..eb4dfb16 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExpandThread.java @@ -66,6 +66,7 @@ * The type Add thread. */ public class ExpandThread extends SwingWorker { + //input private Work work; private DataObjectPackageTreeNode targetNode; @@ -94,12 +95,15 @@ public static void launchExpandThread(DataObjectPackageTreeNode node, BinaryData expandThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.mainWindow, - "Erreur fatale, impossible de faire l'expansion \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.mainWindow, + "Erreur fatale, impossible de faire l'expansion \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de faire l'expansion", e); } - } /** @@ -110,8 +114,12 @@ public static void launchExpandThread(DataObjectPackageTreeNode node, BinaryData * @param bdoToExpand the binary data object to expand * @param dialog the dialog */ - public ExpandThread(Work work, DataObjectPackageTreeNode targetNode, BinaryDataObject bdoToExpand, - InOutDialog dialog) { + public ExpandThread( + Work work, + DataObjectPackageTreeNode targetNode, + BinaryDataObject bdoToExpand, + InOutDialog dialog + ) { this.work = work; this.targetNode = targetNode; this.bdoToExpand = bdoToExpand; @@ -123,17 +131,22 @@ public ExpandThread(Work work, DataObjectPackageTreeNode targetNode, BinaryDataO private void recursiveDelete(File inFile) throws InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); } else { inFile.delete(); fileCounter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, fileCounter, fileCounter + " fichiers effacés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + fileCounter, + fileCounter + " fichiers effacés" + ); } } - private String getTmpDirTarget(String workDir, String srcPathName, String id) throws ResipException, InterruptedException { + private String getTmpDirTarget(String workDir, String srcPathName, String id) + throws ResipException, InterruptedException { String subDir = Paths.get(srcPathName).getFileName().toString() + "-" + id + "-tmpdir"; String target = workDir + File.separator + subDir; if (Files.exists(Paths.get(target))) { @@ -146,7 +159,7 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th target = utdd.getResult(); } else if ((utdd.getReturnValue() == STATUS_CONTINUE) || (utdd.getReturnValue() == STATUS_CHANGE)) { target = utdd.getResult(); - } else {// STATUS_CANCEL + } else { // STATUS_CANCEL this.cancel(false); throw new ResipException("Opération annulée"); } @@ -176,20 +189,46 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - doProgressLog(spl, GLOBAL, "Expansion du BinaryDataObject " + bdoToExpand.getInDataObjectPackageId() + ", fichier [" + bdoToExpand.getMetadataFileInfo().getSimpleMetadata("Filename") + "]", null); + doProgressLog( + spl, + GLOBAL, + "Expansion du BinaryDataObject " + + bdoToExpand.getInDataObjectPackageId() + + ", fichier [" + + bdoToExpand.getMetadataFileInfo().getSimpleMetadata("Filename") + + "]", + null + ); ZipImportContext zic = new ZipImportContext(Preferences.getInstance()); - String target = getTmpDirTarget(zic.getWorkDir(), bdoToExpand.getOnDiskPathToString(), bdoToExpand.getInDataObjectPackageId()); - zi = new CompressedFileToArchiveTransferImporter(bdoToExpand.getOnDiskPathToString(), target, null, null, spl); - for (String ip : zic.getIgnorePatternList()) - zi.addIgnorePattern(ip); + String target = getTmpDirTarget( + zic.getWorkDir(), + bdoToExpand.getOnDiskPathToString(), + bdoToExpand.getInDataObjectPackageId() + ); + zi = new CompressedFileToArchiveTransferImporter( + bdoToExpand.getOnDiskPathToString(), + target, + null, + null, + spl + ); + for (String ip : zic.getIgnorePatternList()) zi.addIgnorePattern(ip); zi.doImport(); summary = zi.getSummary(); } catch (Throwable e) { @@ -203,21 +242,41 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Expansion annulée, les données n'ont pas été modifiées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant l'expansion, les données n'ont pas été modifiées", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Expansion annulée, les données n'ont pas été modifiées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant l'expansion, les données n'ont pas été modifiées", + exitThrowable + ); else { ResipGraphicApp.getTheApp().currentWork = this.work; - List addedNodes = zi.getArchiveTransfer().getDataObjectPackage().getGhostRootAu().getChildrenAuList() - .getArchiveUnitList(); - targetNode.getArchiveUnit().getDataObjectPackage().moveContentFromDataObjectPackage(zi.getArchiveTransfer().getDataObjectPackage(), targetNode.getArchiveUnit()); + List addedNodes = zi + .getArchiveTransfer() + .getDataObjectPackage() + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList(); + targetNode + .getArchiveUnit() + .getDataObjectPackage() + .moveContentFromDataObjectPackage( + zi.getArchiveTransfer().getDataObjectPackage(), + targetNode.getArchiveUnit() + ); DataObject dataObject = targetNode.getArchiveUnit().getDataObjectRefList().getDataObjectList().get(0); if (dataObject instanceof DataObjectGroup) { DataObjectGroup dog = (DataObjectGroup) dataObject; dog.removeDataObject(bdoToExpand); - if (((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty())) && - dog.getBinaryDataObjectList().isEmpty()) { + if ( + ((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty())) && + dog.getBinaryDataObjectList().isEmpty() + ) { targetNode.getArchiveUnit().removeEmptyDataObjectGroup(); try { targetNode.getArchiveUnit().getContent().addNewMetadata("DescriptionLevel", "RecordGrp"); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java index 803b40a7..cb379b06 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ExportThread.java @@ -68,7 +68,7 @@ public class ExportThread extends SwingWorker { /** * The Sip manifest export. */ - static public final int SIP_MANIFEST_EXPORT = 2; + public static final int SIP_MANIFEST_EXPORT = 2; /** * The Disk export. */ @@ -96,7 +96,6 @@ public class ExportThread extends SwingWorker { // logger private SEDALibProgressLogger spl; - /** * Instantiates a new Export thread. * @@ -119,9 +118,8 @@ public ExportThread(Work work, int exportType, InOutDialog dialog) { * @return the string */ public static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -139,11 +137,19 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); // first verify and reindex if neccesary @@ -153,66 +159,121 @@ public String doInBackground() { } ArchiveTransfer archiveTransfer = new ArchiveTransfer(); - work.getDataObjectPackage().setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); + work + .getDataObjectPackage() + .setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); archiveTransfer.setDataObjectPackage(work.getDataObjectPackage()); archiveTransfer.setGlobalMetadata(work.getExportContext().getArchiveTransferGlobalMetadata()); - if (work.getExportContext().isMetadataFilterFlag()) - work.getDataObjectPackage().setExportMetadataList(work.getExportContext().getKeptMetadataList()); - else - work.getDataObjectPackage().setExportMetadataList(null); + if (work.getExportContext().isMetadataFilterFlag()) work + .getDataObjectPackage() + .setExportMetadataList(work.getExportContext().getKeptMetadataList()); + else work.getDataObjectPackage().setExportMetadataList(null); switch (exportType) { case SIP_MANIFEST_EXPORT: - inOutDialog.extProgressTextArea.setText("Export du manifest SEDA en " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export du manifest SEDA en " + work.getExportContext().getOnDiskOutput() + "\n" + ); ArchiveTransferToSIPExporter sm = new ArchiveTransferToSIPExporter(archiveTransfer, spl); - sm.doExportToSEDAXMLManifest(work.getExportContext().getOnDiskOutput(), work.getExportContext().isHierarchicalArchiveUnits(), - work.getExportContext().isIndented()); - doProgressLog(spl, GLOBAL, - "resip: fichier sauvegardé (" + readableFileSize(new File(work.getExportContext().getOnDiskOutput()).length()) + ")", null); + sm.doExportToSEDAXMLManifest( + work.getExportContext().getOnDiskOutput(), + work.getExportContext().isHierarchicalArchiveUnits(), + work.getExportContext().isIndented() + ); + doProgressLog( + spl, + GLOBAL, + "resip: fichier sauvegardé (" + + readableFileSize(new File(work.getExportContext().getOnDiskOutput()).length()) + + ")", + null + ); summary = sm.getSummary(); break; case SIP_ALL_EXPORT: - inOutDialog.extProgressTextArea.setText("Export du SIP SEDA en " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export du SIP SEDA en " + work.getExportContext().getOnDiskOutput() + "\n" + ); ArchiveTransferToSIPExporter smm = new ArchiveTransferToSIPExporter(archiveTransfer, spl); - smm.doExportToSEDASIP(work.getExportContext().getOnDiskOutput(), work.getExportContext().isHierarchicalArchiveUnits(), - work.getExportContext().isIndented()); - doProgressLog(spl, GLOBAL, - "resip: fichier sauvegardé (" + readableFileSize(new File(work.getExportContext().getOnDiskOutput()).length()) + ")", null); + smm.doExportToSEDASIP( + work.getExportContext().getOnDiskOutput(), + work.getExportContext().isHierarchicalArchiveUnits(), + work.getExportContext().isIndented() + ); + doProgressLog( + spl, + GLOBAL, + "resip: fichier sauvegardé (" + + readableFileSize(new File(work.getExportContext().getOnDiskOutput()).length()) + + ")", + null + ); summary = smm.getSummary(); break; case DISK_EXPORT: - inOutDialog.extProgressTextArea.setText("Export en hiérarchie disque complète en " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export en hiérarchie disque complète en " + work.getExportContext().getOnDiskOutput() + "\n" + ); ArchiveTransferToDiskExporter de = new ArchiveTransferToDiskExporter(archiveTransfer, spl); de.doExport(work.getExportContext().getOnDiskOutput()); summary = de.getSummary(); break; case CSV_ALL_DISK_EXPORT: - inOutDialog.extProgressTextArea.setText("Export en hiérarchie disque simplifiée avec fichier csv des métadonnées " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export en hiérarchie disque simplifiée avec fichier csv des métadonnées " + + work.getExportContext().getOnDiskOutput() + + "\n" + ); CSVImportContext cmic = new CSVImportContext(Preferences.getInstance()); DataObjectPackageToCSVMetadataExporter cme = new DataObjectPackageToCSVMetadataExporter( - archiveTransfer.getDataObjectPackage(), cmic.getCsvCharsetName(), cmic.getDelimiter(), - work.getExportContext().getUsageVersionSelectionMode(), work.getExportContext().isCsvExtendedFormat(), work.getExportContext().getMaxNameSize(), spl); + archiveTransfer.getDataObjectPackage(), + cmic.getCsvCharsetName(), + cmic.getDelimiter(), + work.getExportContext().getUsageVersionSelectionMode(), + work.getExportContext().isCsvExtendedFormat(), + work.getExportContext().getMaxNameSize(), + spl + ); cme.doExportToCSVDiskHierarchy(work.getExportContext().getOnDiskOutput(), "metadata.csv"); summary = cme.getSummary(); break; case CSV_ALL_ZIP_EXPORT: - inOutDialog.extProgressTextArea.setText("Export en hiérarchie disque simplifiée dans un zip avec fichier csv des métadonnées " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export en hiérarchie disque simplifiée dans un zip avec fichier csv des métadonnées " + + work.getExportContext().getOnDiskOutput() + + "\n" + ); CSVImportContext cmicz = new CSVImportContext(Preferences.getInstance()); DataObjectPackageToCSVMetadataExporter cmez = new DataObjectPackageToCSVMetadataExporter( - archiveTransfer.getDataObjectPackage(), cmicz.getCsvCharsetName(), cmicz.getDelimiter(), - work.getExportContext().getUsageVersionSelectionMode(), work.getExportContext().isCsvExtendedFormat(), work.getExportContext().getMaxNameSize(), spl); + archiveTransfer.getDataObjectPackage(), + cmicz.getCsvCharsetName(), + cmicz.getDelimiter(), + work.getExportContext().getUsageVersionSelectionMode(), + work.getExportContext().isCsvExtendedFormat(), + work.getExportContext().getMaxNameSize(), + spl + ); cmez.doExportToCSVZip(work.getExportContext().getOnDiskOutput(), "metadata.csv"); summary = cmez.getSummary(); break; case CSV_METADATA_FILE_EXPORT: - inOutDialog.extProgressTextArea.setText("Export en hiérarchie disque simplifiée avec fichier csv des métadonnées " + work.getExportContext().getOnDiskOutput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Export en hiérarchie disque simplifiée avec fichier csv des métadonnées " + + work.getExportContext().getOnDiskOutput() + + "\n" + ); CSVImportContext cmicm = new CSVImportContext(Preferences.getInstance()); DataObjectPackageToCSVMetadataExporter cmem = new DataObjectPackageToCSVMetadataExporter( - archiveTransfer.getDataObjectPackage(), cmicm.getCsvCharsetName(), cmicm.getDelimiter(), - work.getExportContext().getUsageVersionSelectionMode(), work.getExportContext().isCsvExtendedFormat(), work.getExportContext().getMaxNameSize(), spl); + archiveTransfer.getDataObjectPackage(), + cmicm.getCsvCharsetName(), + cmicm.getDelimiter(), + work.getExportContext().getUsageVersionSelectionMode(), + work.getExportContext().isCsvExtendedFormat(), + work.getExportContext().getMaxNameSize(), + spl + ); cmem.doExportToCSVMetadataFile(work.getExportContext().getOnDiskOutput()); summary = cmem.getSummary(); break; - default: throw new ResipException("Export attendu inconnu"); } @@ -227,17 +288,30 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: export annulé, les données seront partiellement sur le disque", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant l'export, les données seront partiellement sur le disque", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: export annulé, les données seront partiellement sur le disque", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant l'export, les données seront partiellement sur le disque", + exitThrowable + ); else { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: export terminé", null); doProgressLogWithoutInterruption(spl, GLOBAL, summary, null); try { Preferences.getInstance().setPrefsExportDirFromChild(work.getExportContext().getOnDiskOutput()); } catch (ResipException e) { - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: la localisation d'export par défaut n'a pu être actualisée dans les préférences", e); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: la localisation d'export par défaut n'a pu être actualisée dans les préférences", + e + ); } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java index b1073da4..b175ec45 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/ImportThread.java @@ -67,6 +67,7 @@ * The type Import thread. */ public class ImportThread extends SwingWorker { + //input private Work work; private InOutDialog inOutDialog; @@ -95,34 +96,44 @@ public ImportThread(CreationContext cc, InOutDialog dialog) { private void setWorkFromArchiveTransfer(ArchiveTransfer archiveTransfer) { work.setDataObjectPackage(archiveTransfer.getDataObjectPackage()); ExportContext newExportContext = new ExportContext(Preferences.getInstance()); - if (archiveTransfer.getGlobalMetadata() != null) - newExportContext.setArchiveTransferGlobalMetadata(archiveTransfer.getGlobalMetadata()); - if (archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData() != null) - newExportContext.setManagementMetadataXmlData( - archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData()); + if (archiveTransfer.getGlobalMetadata() != null) newExportContext.setArchiveTransferGlobalMetadata( + archiveTransfer.getGlobalMetadata() + ); + if ( + archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData() != null + ) newExportContext.setManagementMetadataXmlData( + archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData() + ); work.setExportContext(newExportContext); } private void setWorkFromArchiveDeliveryRequestReply(ArchiveDeliveryRequestReply archiveDeliveryRequestReply) { work.setDataObjectPackage(archiveDeliveryRequestReply.getDataObjectPackage()); ExportContext newExportContext = new ExportContext(Preferences.getInstance()); - if (archiveDeliveryRequestReply.getGlobalMetadata() != null) - newExportContext.setArchiveTransferGlobalMetadata(archiveDeliveryRequestReply.getGlobalMetadata()); - if (archiveDeliveryRequestReply.getDataObjectPackage().getManagementMetadataXmlData() != null) - newExportContext.setManagementMetadataXmlData( - archiveDeliveryRequestReply.getDataObjectPackage().getManagementMetadataXmlData()); + if (archiveDeliveryRequestReply.getGlobalMetadata() != null) newExportContext.setArchiveTransferGlobalMetadata( + archiveDeliveryRequestReply.getGlobalMetadata() + ); + if ( + archiveDeliveryRequestReply.getDataObjectPackage().getManagementMetadataXmlData() != null + ) newExportContext.setManagementMetadataXmlData( + archiveDeliveryRequestReply.getDataObjectPackage().getManagementMetadataXmlData() + ); work.setExportContext(newExportContext); } private void recursiveDelete(File inFile) throws InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); //NOSONAR use the quickest method } else { inFile.delete(); //NOSONAR use the quickest method fileCounter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, fileCounter, fileCounter + " fichiers effacés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + fileCounter, + fileCounter + " fichiers effacés" + ); } } @@ -139,7 +150,7 @@ private String getTmpDirTarget(String workDir, String srcPathName) throws ResipE target = utdd.getResult(); } else if ((utdd.getReturnValue() == STATUS_CONTINUE) || (utdd.getReturnValue() == STATUS_CHANGE)) { target = utdd.getResult(); - } else {// STATUS_CANCEL + } else { // STATUS_CANCEL this.cancel(false); throw new ResipException("Opération annulée"); } @@ -148,33 +159,41 @@ private String getTmpDirTarget(String workDir, String srcPathName) throws ResipE } private void doZipImport() throws ResipException, InterruptedException, SEDALibException { - inOutDialog.extProgressTextArea.setText("Import depuis un fichier zip en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un fichier zip en " + work.getCreationContext().getOnDiskInput() + "\n" + ); ZipImportContext zic = (ZipImportContext) work.getCreationContext(); String target = getTmpDirTarget(zic.getWorkDir(), zic.getOnDiskInput()); //TODO add preferences for compressed filename import String encoding; - if (work.getCreationContext().getOnDiskInput().endsWith("zip")) - encoding = "CP850"; - else - encoding = "UTF8"; - CompressedFileToArchiveTransferImporter zi = new CompressedFileToArchiveTransferImporter(work.getCreationContext().getOnDiskInput(), target, encoding, null, - spl); - for (String ip : zic.getIgnorePatternList()) - zi.addIgnorePattern(ip); + if (work.getCreationContext().getOnDiskInput().endsWith("zip")) encoding = "CP850"; + else encoding = "UTF8"; + CompressedFileToArchiveTransferImporter zi = new CompressedFileToArchiveTransferImporter( + work.getCreationContext().getOnDiskInput(), + target, + encoding, + null, + spl + ); + for (String ip : zic.getIgnorePatternList()) zi.addIgnorePattern(ip); zi.doImport(); setWorkFromArchiveTransfer(zi.getArchiveTransfer()); summary = zi.getSummary(); } private void doDiskImport() throws SEDALibException, InterruptedException { - inOutDialog.extProgressTextArea.setText("Import depuis une hiérarchie disque en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis une hiérarchie disque en " + work.getCreationContext().getOnDiskInput() + "\n" + ); DiskImportContext diskImportContext = (DiskImportContext) work.getCreationContext(); - DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter(work.getCreationContext().getOnDiskInput(), - diskImportContext.isNoLinkFlag(), null, - spl); - for (String ip : diskImportContext.getIgnorePatternList()) - di.addIgnorePattern(ip); + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + work.getCreationContext().getOnDiskInput(), + diskImportContext.isNoLinkFlag(), + null, + spl + ); + for (String ip : diskImportContext.getIgnorePatternList()) di.addIgnorePattern(ip); di.doImport(); diskImportContext.setModelVersion(di.getModelVersion()); setWorkFromArchiveTransfer(di.getArchiveTransfer()); @@ -182,32 +201,44 @@ private void doDiskImport() throws SEDALibException, InterruptedException { } private void doSIPImport() throws SEDALibException, InterruptedException, ResipException { - inOutDialog.extProgressTextArea.setText("Import depuis un fichier SIP en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un fichier SIP en " + work.getCreationContext().getOnDiskInput() + "\n" + ); SIPImportContext sic = (SIPImportContext) work.getCreationContext(); String target = getTmpDirTarget(sic.getWorkDir(), sic.getOnDiskInput()); - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter(sic.getOnDiskInput(), - target, spl); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter(sic.getOnDiskInput(), target, spl); si.doImport(); setWorkFromArchiveTransfer(si.getArchiveTransfer()); summary = si.getSummary(); } private void doDIPImport() throws ResipException, InterruptedException, SEDALibException { - inOutDialog.extProgressTextArea.setText("Import depuis un fichier DIP en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un fichier DIP en " + work.getCreationContext().getOnDiskInput() + "\n" + ); DIPImportContext dic = (DIPImportContext) work.getCreationContext(); String target = getTmpDirTarget(dic.getWorkDir(), dic.getOnDiskInput()); DIPToArchiveDeliveryRequestReplyImporter si = new DIPToArchiveDeliveryRequestReplyImporter( - dic.getOnDiskInput(), target, spl); + dic.getOnDiskInput(), + target, + spl + ); si.doImport(); setWorkFromArchiveDeliveryRequestReply(si.getArchiveDeliveryRequestReply()); summary = si.getSummary(); } private void doCSVTreeImport() throws SEDALibException, InterruptedException { - inOutDialog.extProgressTextArea.setText("Import depuis un csv d'arbre de classement en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un csv d'arbre de classement en " + work.getCreationContext().getOnDiskInput() + "\n" + ); CSVTreeImportContext ctic = (CSVTreeImportContext) work.getCreationContext(); CSVTreeToDataObjectPackageImporter cti = new CSVTreeToDataObjectPackageImporter( - ctic.getOnDiskInput(), ctic.getCsvCharsetName(), ctic.getDelimiter(), spl); + ctic.getOnDiskInput(), + ctic.getCsvCharsetName(), + ctic.getDelimiter(), + spl + ); cti.doImport(); work.setDataObjectPackage(cti.getDataObjectPackage()); work.setExportContext(new ExportContext(Preferences.getInstance())); @@ -215,10 +246,16 @@ private void doCSVTreeImport() throws SEDALibException, InterruptedException { } private void doCSVMetadataImportContext() throws SEDALibException, InterruptedException { - inOutDialog.extProgressTextArea.setText("Import depuis un csv de métadonnées en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un csv de métadonnées en " + work.getCreationContext().getOnDiskInput() + "\n" + ); CSVMetadataImportContext cmic = (CSVMetadataImportContext) work.getCreationContext(); CSVMetadataToDataObjectPackageImporter cmi = new CSVMetadataToDataObjectPackageImporter( - cmic.getOnDiskInput(), cmic.getCsvCharsetName(), cmic.getDelimiter(), spl); + cmic.getOnDiskInput(), + cmic.getCsvCharsetName(), + cmic.getDelimiter(), + spl + ); cmi.doImport(); work.setDataObjectPackage(cmi.getDataObjectPackage()); work.setExportContext(new ExportContext(Preferences.getInstance())); @@ -228,7 +265,9 @@ private void doCSVMetadataImportContext() throws SEDALibException, InterruptedEx private void doMailImportContext() throws ResipException, InterruptedException, SEDALibException { int localLogLevel; int localLogStep; - inOutDialog.extProgressTextArea.setText("Import depuis un conteneur courriel en " + work.getCreationContext().getOnDiskInput() + "\n"); + inOutDialog.extProgressTextArea.setText( + "Import depuis un conteneur courriel en " + work.getCreationContext().getOnDiskInput() + "\n" + ); if (ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()) { localLogLevel = MailExtractProgressLogger.MESSAGE_DETAILS; localLogStep = 1; @@ -236,27 +275,43 @@ private void doMailImportContext() throws ResipException, InterruptedException, localLogLevel = MailExtractProgressLogger.MESSAGE_GROUP; localLogStep = 1000; } - MailExtractProgressLogger mepl = new MailExtractProgressLogger(ResipLogger.getGlobalLogger().getLogger(), - localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,MailExtractProgressLogger.MESSAGE_GROUP,1000); + MailExtractProgressLogger mepl = new MailExtractProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + MailExtractProgressLogger.MESSAGE_GROUP, + 1000 + ); mepl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); MailImportContext mic = (MailImportContext) work.getCreationContext(); String target = getTmpDirTarget(mic.getWorkDir(), mic.getOnDiskInput()); - MailImporter mi = new MailImporter(mic.isExtractMessageTextFile(), mic.isExtractMessageTextMetadata(), - mic.isExtractAttachmentTextFile(), mic.isExtractAttachmentTextMetadata(), mic.getProtocol(), - mic.getDefaultCharsetName(), mic.getOnDiskInput(), mic.getMailFolder(), target, mepl); + MailImporter mi = new MailImporter( + mic.isExtractMessageTextFile(), + mic.isExtractMessageTextMetadata(), + mic.isExtractAttachmentTextFile(), + mic.isExtractAttachmentTextMetadata(), + mic.getProtocol(), + mic.getDefaultCharsetName(), + mic.getOnDiskInput(), + mic.getMailFolder(), + target, + mepl + ); mi.doExtract(); doProgressLog(spl, GLOBAL, "resip: extraction terminée\n" + mi.getSummary(), null); List lp = new ArrayList<>(); lp.add(Paths.get(mi.getTarget())); DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter(lp, spl); - for (String ip : new DiskImportContext(Preferences.getInstance()) - .getIgnorePatternList()) - di.addIgnorePattern(ip); + for (String ip : new DiskImportContext(Preferences.getInstance()).getIgnorePatternList()) di.addIgnorePattern( + ip + ); di.doImport(); setWorkFromArchiveTransfer(di.getArchiveTransfer()); summary = mi.getSummary() + "\n" + di.getSummary(); @@ -275,28 +330,28 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - if (work.getCreationContext() instanceof ZipImportContext) - doZipImport(); - else if (work.getCreationContext() instanceof DiskImportContext) - doDiskImport(); - else if (work.getCreationContext() instanceof SIPImportContext) - doSIPImport(); - else if (work.getCreationContext() instanceof DIPImportContext) - doDIPImport(); - else if (work.getCreationContext() instanceof CSVTreeImportContext) - doCSVTreeImport(); - else if (work.getCreationContext() instanceof CSVMetadataImportContext) - doCSVMetadataImportContext(); - else if (work.getCreationContext() instanceof MailImportContext) - doMailImportContext(); - if (work.getDataObjectPackage() != null) - summary += "\n" + work.doVitamNormalize(spl); + if (work.getCreationContext() instanceof ZipImportContext) doZipImport(); + else if (work.getCreationContext() instanceof DiskImportContext) doDiskImport(); + else if (work.getCreationContext() instanceof SIPImportContext) doSIPImport(); + else if (work.getCreationContext() instanceof DIPImportContext) doDIPImport(); + else if (work.getCreationContext() instanceof CSVTreeImportContext) doCSVTreeImport(); + else if (work.getCreationContext() instanceof CSVMetadataImportContext) doCSVMetadataImportContext(); + else if (work.getCreationContext() instanceof MailImportContext) doMailImportContext(); + if (work.getDataObjectPackage() != null) summary += "\n" + work.doVitamNormalize(spl); } catch (Throwable e) { exitThrowable = e; work = null; @@ -311,10 +366,19 @@ protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: import annulé, les données n'ont pas été modifiées", null); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: import annulé, les données n'ont pas été modifiées", + null + ); else if (exitThrowable != null) { - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant l'import, les données n'ont pas été modifiées", exitThrowable); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant l'import, les données n'ont pas été modifiées", + exitThrowable + ); } else { work.getCreationContext().setSummary(summary); theApp.currentWork = work; @@ -327,7 +391,12 @@ else if (exitThrowable != null) { try { Preferences.getInstance().setPrefsImportDirFromChild(work.getCreationContext().getOnDiskInput()); } catch (ResipException e) { - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: la localisation d'import par défaut n'a pu être actualisée dans les préférences", e); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: la localisation d'import par défaut n'a pu être actualisée dans les préférences", + e + ); } } theApp.importThreadRunning = false; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java index 198a6e60..6c96f72f 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/MailExtractThread.java @@ -76,6 +76,7 @@ * The type Add thread. */ public class MailExtractThread extends SwingWorker { + //input private Work work; private DataObjectPackageTreeNode targetNode; @@ -100,16 +101,25 @@ public static void launchMailExtractThread(DataObjectPackageTreeNode node, Binar try { InOutDialog inOutDialog = new InOutDialog(ResipGraphicApp.mainWindow, "Extraction de messages"); - mailExtractThread = new MailExtractThread(ResipGraphicApp.getTheApp().currentWork, node, bdoToExpand, inOutDialog); + mailExtractThread = new MailExtractThread( + ResipGraphicApp.getTheApp().currentWork, + node, + bdoToExpand, + inOutDialog + ); mailExtractThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.mainWindow, - "Erreur fatale, impossible de faire l'extraction de messages \n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); - ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de faire l'extraction de messages", e); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.mainWindow, + "Erreur fatale, impossible de faire l'extraction de messages \n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); + ResipLogger.getGlobalLogger() + .log(ResipLogger.ERROR, "Erreur fatale, impossible de faire l'extraction de messages", e); } - } /** @@ -120,8 +130,12 @@ public static void launchMailExtractThread(DataObjectPackageTreeNode node, Binar * @param bdoToExpand the binary data object to expand * @param dialog the dialog */ - public MailExtractThread(Work work, DataObjectPackageTreeNode targetNode, BinaryDataObject bdoToExpand, - InOutDialog dialog) { + public MailExtractThread( + Work work, + DataObjectPackageTreeNode targetNode, + BinaryDataObject bdoToExpand, + InOutDialog dialog + ) { this.work = work; this.targetNode = targetNode; this.bdoToExpand = bdoToExpand; @@ -133,17 +147,22 @@ public MailExtractThread(Work work, DataObjectPackageTreeNode targetNode, Binary private void recursiveDelete(File inFile) throws InterruptedException { if (inFile.isDirectory()) { - for (File f : inFile.listFiles()) - recursiveDelete(f); + for (File f : inFile.listFiles()) recursiveDelete(f); inFile.delete(); } else { inFile.delete(); fileCounter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, fileCounter, fileCounter + " fichiers effacés"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + fileCounter, + fileCounter + " fichiers effacés" + ); } } - private String getTmpDirTarget(String workDir, String srcPathName, String id) throws ResipException, InterruptedException { + private String getTmpDirTarget(String workDir, String srcPathName, String id) + throws ResipException, InterruptedException { String subDir = Paths.get(srcPathName).getFileName().toString() + "-" + id + "-tmpdir"; String target = workDir + File.separator + subDir; if (Files.exists(Paths.get(target))) { @@ -156,7 +175,7 @@ private String getTmpDirTarget(String workDir, String srcPathName, String id) th target = utdd.getResult(); } else if ((utdd.getReturnValue() == STATUS_CONTINUE) || (utdd.getReturnValue() == STATUS_CHANGE)) { target = utdd.getResult(); - } else {// STATUS_CANCEL + } else { // STATUS_CANCEL this.cancel(false); throw new ResipException("Opération annulée"); } @@ -186,41 +205,78 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - doProgressLog(spl, GLOBAL, "Extraction de massages du BinaryDataObject " + bdoToExpand.getInDataObjectPackageId() + ", fichier [" + bdoToExpand.getMetadataFileInfo().getSimpleMetadata("Filename") + "]", null); + doProgressLog( + spl, + GLOBAL, + "Extraction de massages du BinaryDataObject " + + bdoToExpand.getInDataObjectPackageId() + + ", fichier [" + + bdoToExpand.getMetadataFileInfo().getSimpleMetadata("Filename") + + "]", + null + ); - MailExtractProgressLogger mepl = new MailExtractProgressLogger(ResipLogger.getGlobalLogger().getLogger(), - localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,MailExtractProgressLogger.MESSAGE_GROUP,1000); + MailExtractProgressLogger mepl = new MailExtractProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + MailExtractProgressLogger.MESSAGE_GROUP, + 1000 + ); mepl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); MailImportContext mic = new MailImportContext(Preferences.getInstance()); - String target = getTmpDirTarget(mic.getWorkDir(), bdoToExpand.getOnDiskPathToString(), bdoToExpand.getInDataObjectPackageId()); - MailImporter mi = new MailImporter(mic.isExtractMessageTextFile(), mic.isExtractMessageTextMetadata(), - mic.isExtractAttachmentTextFile(), mic.isExtractAttachmentTextMetadata(), - StoreExtractor.getProtocolFromDroidFormat(bdoToExpand.getMetadataFormatIdentification().getSimpleMetadata("FormatId")), - mic.getDefaultCharsetName(), bdoToExpand.getOnDiskPathToString(), "", target, mepl); + String target = getTmpDirTarget( + mic.getWorkDir(), + bdoToExpand.getOnDiskPathToString(), + bdoToExpand.getInDataObjectPackageId() + ); + MailImporter mi = new MailImporter( + mic.isExtractMessageTextFile(), + mic.isExtractMessageTextMetadata(), + mic.isExtractAttachmentTextFile(), + mic.isExtractAttachmentTextMetadata(), + StoreExtractor.getProtocolFromDroidFormat( + bdoToExpand.getMetadataFormatIdentification().getSimpleMetadata("FormatId") + ), + mic.getDefaultCharsetName(), + bdoToExpand.getOnDiskPathToString(), + "", + target, + mepl + ); mi.doExtract(); doProgressLog(spl, GLOBAL, "resip: extraction de messages terminée\n" + mi.getSummary(), null); List lp = new ArrayList<>(); try (DirectoryStream stream = Files.newDirectoryStream(Paths.get(mi.getTarget()))) { for (Path path : stream) { - if (!path.toString().endsWith("__ArchiveUnitMetadata.xml")) - lp.add(path); + if (!path.toString().endsWith("__ArchiveUnitMetadata.xml")) lp.add(path); } } di = new DiskToArchiveTransferImporter(lp, spl); - for (String ip : new DiskImportContext(Preferences.getInstance()) - .getIgnorePatternList()) - di.addIgnorePattern(ip); + for (String ip : new DiskImportContext( + Preferences.getInstance() + ).getIgnorePatternList()) di.addIgnorePattern(ip); di.doImport(); summary = mi.getSummary() + "\n" + di.getSummary(); } catch (Throwable e) { @@ -234,21 +290,41 @@ public String doInBackground() { protected void done() { inOutDialog.okButton.setEnabled(true); inOutDialog.cancelButton.setEnabled(false); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "Extraction de messages annulée, les données n'ont pas été modifiées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "Erreur durant l'extraction de messages, les données n'ont pas été modifiées", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Extraction de messages annulée, les données n'ont pas été modifiées", + null + ); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "Erreur durant l'extraction de messages, les données n'ont pas été modifiées", + exitThrowable + ); else { ResipGraphicApp.getTheApp().currentWork = this.work; - List addedNodes = di.getArchiveTransfer().getDataObjectPackage().getGhostRootAu().getChildrenAuList() - .getArchiveUnitList(); - targetNode.getArchiveUnit().getDataObjectPackage().moveContentFromDataObjectPackage(di.getArchiveTransfer().getDataObjectPackage(), targetNode.getArchiveUnit()); + List addedNodes = di + .getArchiveTransfer() + .getDataObjectPackage() + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList(); + targetNode + .getArchiveUnit() + .getDataObjectPackage() + .moveContentFromDataObjectPackage( + di.getArchiveTransfer().getDataObjectPackage(), + targetNode.getArchiveUnit() + ); DataObject dataObject = targetNode.getArchiveUnit().getDataObjectRefList().getDataObjectList().get(0); if (dataObject instanceof DataObjectGroup) { DataObjectGroup dog = (DataObjectGroup) dataObject; dog.removeDataObject(bdoToExpand); - if (((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty())) && - dog.getBinaryDataObjectList().isEmpty()){ + if ( + ((dog.getPhysicalDataObjectList() == null) || (dog.getPhysicalDataObjectList().isEmpty())) && + dog.getBinaryDataObjectList().isEmpty() + ) { targetNode.getArchiveUnit().removeEmptyDataObjectGroup(); try { targetNode.getArchiveUnit().getContent().addNewMetadata("DescriptionLevel", "RecordGrp"); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java index f763d062..922b8f46 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SearchThread.java @@ -71,17 +71,22 @@ public class SearchThread extends SwingWorker { private Pattern searchPattern; private List searchResult; - /** * Instantiates a new Search thread. * * @param au the au */ - public SearchThread(ArchiveUnit au, - boolean isWithoutChildArchiveUnitCheck, boolean isWithoutDataObjectGroupCheck, - boolean isIdCheck, boolean isMetadataCheck, boolean isRegExpCheck, boolean isCaseCheck, - String searchText, - Consumer> callBack) { + public SearchThread( + ArchiveUnit au, + boolean isWithoutChildArchiveUnitCheck, + boolean isWithoutDataObjectGroupCheck, + boolean isIdCheck, + boolean isMetadataCheck, + boolean isRegExpCheck, + boolean isCaseCheck, + String searchText, + Consumer> callBack + ) { this.searchUnit = au; this.isWithoutChildArchiveUnitCheck = isWithoutChildArchiveUnitCheck; this.isWithoutDataObjectGroupCheck = isWithoutDataObjectGroupCheck; @@ -103,46 +108,44 @@ void searchInArchiveUnit(ArchiveUnit au) { TreeDataObjectPackageEditorPanel treePane = ResipGraphicApp.getTheWindow().treePane; for (ArchiveUnit childUnit : auList) { - if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) - continue; + if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) continue; try { String tmp; int dataObjectCount = 0; if (childUnit.getTheDataObjectGroup() != null) { DataObjectGroup dataObjectGroup = childUnit.getTheDataObjectGroup(); - dataObjectCount = dataObjectGroup.getBinaryDataObjectList().size() + dataObjectGroup.getPhysicalDataObjectList().size(); + dataObjectCount = dataObjectGroup.getBinaryDataObjectList().size() + + dataObjectGroup.getPhysicalDataObjectList().size(); } - if (!(isWithoutChildArchiveUnitCheck && (childUnit.getChildrenAuList().getCount() != 0)) && - !(isWithoutDataObjectGroupCheck && (dataObjectCount != 0))) { + if ( + !(isWithoutChildArchiveUnitCheck && (childUnit.getChildrenAuList().getCount() != 0)) && + !(isWithoutDataObjectGroupCheck && (dataObjectCount != 0)) + ) { if (isIdCheck) { tmp = "<" + childUnit.getInDataObjectPackageId() + ">"; for (DataObject dataObject : childUnit.getDataObjectRefList().getDataObjectList()) { tmp += "<" + dataObject.getInDataObjectPackageId() + ">"; if (dataObject instanceof DataObjectGroup) { - for (BinaryDataObject bo : ((DataObjectGroup) dataObject).getBinaryDataObjectList()) - tmp += "<" + bo.getInDataObjectPackageId() + ">"; - for (PhysicalDataObject po : ((DataObjectGroup) dataObject).getPhysicalDataObjectList()) - tmp += "<" + po.getInDataObjectPackageId() + ">"; + for (BinaryDataObject bo : ((DataObjectGroup) dataObject).getBinaryDataObjectList()) tmp += + "<" + bo.getInDataObjectPackageId() + ">"; + for (PhysicalDataObject po : ((DataObjectGroup) dataObject).getPhysicalDataObjectList()) tmp += + "<" + po.getInDataObjectPackageId() + ">"; } } } else if (isMetadataCheck) { tmp = childUnit.getContent().toString(); - } else - tmp = treePane.getTreeTitle(childUnit); + } else tmp = treePane.getTreeTitle(childUnit); if (isRegExpCheck) { Matcher matcher = searchPattern.matcher(tmp); - if (matcher.matches()) - searchResult.add(childUnit); + if (matcher.matches()) searchResult.add(childUnit); } else { if (!isCaseCheck) tmp = tmp.toLowerCase(); - if (tmp.contains(searchExp)) - searchResult.add(childUnit); + if (tmp.contains(searchExp)) searchResult.add(childUnit); } } dataObjectPackage.addTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId()); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} searchInArchiveUnit(childUnit); } } @@ -153,7 +156,7 @@ public String doInBackground() { if (isRegExpCheck) searchPattern = Pattern.compile("[\\S\\s]*" + searchExp + "[\\S\\s]*"); else if (!isCaseCheck) searchExp = searchExp.toLowerCase(); if (isIdCheck) searchExp = "<" + searchExp + ">"; - dataObjectPackage=searchUnit.getDataObjectPackage(); + dataObjectPackage = searchUnit.getDataObjectPackage(); dataObjectPackage.resetTouchedInDataObjectPackageIdMap(); searchResult = new LinkedList(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java index 92290301..7585f3bd 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/SeeManifestThread.java @@ -83,9 +83,13 @@ public static void launchSeeManifestThread(Work work) { seeManifestThread.execute(); inOutDialog.setVisible(true); } catch (Throwable e) { - UserInteractionDialog.getUserAnswer(ResipGraphicApp.getTheApp().mainWindow, - "Erreur fatale, impossible de générer le manifest\n->" + e.getMessage(), "Erreur", - UserInteractionDialog.ERROR_DIALOG, null); + UserInteractionDialog.getUserAnswer( + ResipGraphicApp.getTheApp().mainWindow, + "Erreur fatale, impossible de générer le manifest\n->" + e.getMessage(), + "Erreur", + UserInteractionDialog.ERROR_DIALOG, + null + ); ResipLogger.getGlobalLogger().log(ResipLogger.ERROR, "Erreur fatale, impossible de générer le manifest", e); } } @@ -99,7 +103,6 @@ public SeeManifestThread(ManifestWindow manifestWindow, Work work, InOutDialog i this.inOutDialog = inOutDialog; } - @Override public String doInBackground() { ArchiveTransfer archiveTransfer = new ArchiveTransfer(); @@ -112,24 +115,36 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, (count, log) -> { - String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; - inOutDialog.extProgressTextArea.setText(newLog); - inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); - }, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + (count, log) -> { + String newLog = inOutDialog.extProgressTextArea.getText() + "\n" + log; + inOutDialog.extProgressTextArea.setText(newLog); + inOutDialog.extProgressTextArea.setCaretPosition(newLog.length()); + }, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); - work.getDataObjectPackage().setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); + work + .getDataObjectPackage() + .setManagementMetadataXmlData(work.getExportContext().getManagementMetadataXmlData()); archiveTransfer.setDataObjectPackage(work.getDataObjectPackage()); archiveTransfer.setGlobalMetadata(work.getExportContext().getArchiveTransferGlobalMetadata()); - if (work.getExportContext().isMetadataFilterFlag()) - work.getDataObjectPackage().setExportMetadataList(work.getExportContext().getKeptMetadataList()); - else - work.getDataObjectPackage().setExportMetadataList(null); + if (work.getExportContext().isMetadataFilterFlag()) work + .getDataObjectPackage() + .setExportMetadataList(work.getExportContext().getKeptMetadataList()); + else work.getDataObjectPackage().setExportMetadataList(null); ArchiveTransferToSIPExporter sm = new ArchiveTransferToSIPExporter(archiveTransfer, spl); - manifestString = sm.getSEDAXMLManifest(work.getExportContext().isHierarchicalArchiveUnits(), - work.getExportContext().isIndented()); + manifestString = sm.getSEDAXMLManifest( + work.getExportContext().isHierarchicalArchiveUnits(), + work.getExportContext().isIndented() + ); } catch (Throwable e) { exitThrowable = e; return "KO"; @@ -145,8 +160,12 @@ protected void done() { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: génération du manifest annulée", null); manifestWindow.setVisible(false); manifestWindow.dispose(); - } else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant la génération du manifest", exitThrowable); + } else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant la génération du manifest", + exitThrowable + ); else { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: manifest généré", null); manifestWindow.setText(manifestString); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java index 6f7c95ca..7d728fdf 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/StatisticThread.java @@ -80,8 +80,7 @@ public StatisticThread(StatisticWindow statisticWindow) { private String findCategory(String formatId, LinkedHashMap> formatByCatgeoryMap) { for (Map.Entry> category : formatByCatgeoryMap.entrySet()) { - if (category.getValue().contains(formatId)) - return category.getKey(); + if (category.getValue().contains(formatId)) return category.getKey(); } return null; } @@ -97,39 +96,53 @@ public String doInBackground() { localLogLevel = SEDALibProgressLogger.OBJECTS_GROUP; localLogStep = 1000; } - spl = new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), localLogLevel, - null, localLogStep, 2,SEDALibProgressLogger.OBJECTS_GROUP,1000); + spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + localLogLevel, + null, + localLogStep, + 2, + SEDALibProgressLogger.OBJECTS_GROUP, + 1000 + ); spl.setDebugFlag(ResipGraphicApp.getTheApp().interfaceParameters.isDebugFlag()); DataObjectPackage dataObjectPackage = ResipGraphicApp.getTheApp().currentWork.getDataObjectPackage(); LinkedHashMap> sizeByCategoryMap = new LinkedHashMap>(); - LinkedHashMap> formatByCatgeoryMap = ResipGraphicApp.getTheApp().treatmentParameters.getFormatByCategoryMap(); + LinkedHashMap> formatByCatgeoryMap = ResipGraphicApp.getTheApp() + .treatmentParameters.getFormatByCategoryMap(); String otherCategory = null; for (Map.Entry> category : formatByCatgeoryMap.entrySet()) { sizeByCategoryMap.put(category.getKey(), new ArrayList()); - if (category.getValue().contains("Other")) - otherCategory = category.getKey(); + if (category.getValue().contains("Other")) otherCategory = category.getKey(); } sizeByCategoryMap.put("Tous formats", new ArrayList()); int counter = 0; for (BinaryDataObject bdo : dataObjectPackage.getBdoInDataObjectPackageIdMap().values()) { String category = null; FormatIdentification formatIdentification = bdo.getMetadataFormatIdentification(); - if (formatIdentification != null) - category = findCategory(formatIdentification.getSimpleMetadata("FormatId"), formatByCatgeoryMap); + if (formatIdentification != null) category = findCategory( + formatIdentification.getSimpleMetadata("FormatId"), + formatByCatgeoryMap + ); if (category == null) category = otherCategory; - IntegerType size=bdo.getMetadataSize(); + IntegerType size = bdo.getMetadataSize(); if (size != null) { - if (category != null) - sizeByCategoryMap.get(category).add(size.getValue()); + if (category != null) sizeByCategoryMap.get(category).add(size.getValue()); sizeByCategoryMap.get("Tous formats").add(size.getValue()); } counter++; - doProgressLogIfStep(spl, SEDALibProgressLogger.OBJECTS_GROUP, counter, "resip: " + - counter + " objets pris en compte dans les statistiques"); + doProgressLogIfStep( + spl, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "resip: " + counter + " objets pris en compte dans les statistiques" + ); } - statisticDataList = sizeByCategoryMap.entrySet().stream() - .map(e -> new StatisticData(e.getKey(), e.getValue())) - .collect(Collectors.toList()); + statisticDataList = sizeByCategoryMap + .entrySet() + .stream() + .map(e -> new StatisticData(e.getKey(), e.getValue())) + .collect(Collectors.toList()); } catch (Throwable e) { exitThrowable = e; return "KO"; @@ -141,29 +154,42 @@ public String doInBackground() { protected void done() { ResipGraphicApp theApp = ResipGraphicApp.getTheApp(); - if (isCancelled()) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: statistiques annulées", null); - else if (exitThrowable != null) - doProgressLogWithoutInterruption(spl, GLOBAL, "resip: erreur durant les statistiques", exitThrowable); + if (isCancelled()) doProgressLogWithoutInterruption(spl, GLOBAL, "resip: statistiques annulées", null); + else if (exitThrowable != null) doProgressLogWithoutInterruption( + spl, + GLOBAL, + "resip: erreur durant les statistiques", + exitThrowable + ); else { doProgressLogWithoutInterruption(spl, GLOBAL, "resip: statistiques terminées", null); statisticWindow.setStatisticDataList(statisticDataList); - doProgressLogWithoutInterruption(spl, GLOBAL, String.format( - "%-40.40s %10s %10s %10s %10s", "Categorie", "Nb", "Min", "Moyenne", "Max"), null); + doProgressLogWithoutInterruption( + spl, + GLOBAL, + String.format("%-40.40s %10s %10s %10s %10s", "Categorie", "Nb", "Min", "Moyenne", "Max"), + null + ); for (StatisticData sd : statisticDataList) { - if (sd.getObjectNumber() != 0) - doProgressLogWithoutInterruption(spl, GLOBAL, String.format( - "%-40.40s %10d %10d %10.0f %10d", - sd.getFormatCategory(), - sd.getObjectNumber(), - sd.getMinSize(), - sd.getMeanSize(), - sd.getMaxSize()), null); - else - doProgressLogWithoutInterruption(spl, GLOBAL, String.format( - "%-40.40s %10d %10s %10s %10s", - sd.getFormatCategory(), - 0, "-", "-", "-"), null); + if (sd.getObjectNumber() != 0) doProgressLogWithoutInterruption( + spl, + GLOBAL, + String.format( + "%-40.40s %10d %10d %10.0f %10d", + sd.getFormatCategory(), + sd.getObjectNumber(), + sd.getMinSize(), + sd.getMeanSize(), + sd.getMaxSize() + ), + null + ); + else doProgressLogWithoutInterruption( + spl, + GLOBAL, + String.format("%-40.40s %10d %10s %10s %10s", sd.getFormatCategory(), 0, "-", "-", "-"), + null + ); } } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java index 7167a1d8..9051ce31 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/TechnicalSearchThread.java @@ -68,7 +68,6 @@ public class TechnicalSearchThread extends SwingWorker { private List otherFormats; private boolean allFormatsFlag; - /** * Instantiates a new Technical search thread. * @@ -77,18 +76,23 @@ public class TechnicalSearchThread extends SwingWorker { * @param min the min * @param max the max */ - public TechnicalSearchThread(ArchiveUnit au, List formats, long min, long max, - Consumer>> callBack) { + public TechnicalSearchThread( + ArchiveUnit au, + List formats, + long min, + long max, + Consumer>> callBack + ) { this.searchUnit = au; this.formats = formats; if (formats.contains("Other")) { this.searchOthers = true; - this.otherFormats = - ResipGraphicApp.getTheApp().treatmentParameters.getFormatByCategoryMap(). - entrySet(). - stream(). - flatMap(e -> e.getValue().stream()). - collect(Collectors.toList()); + this.otherFormats = ResipGraphicApp.getTheApp() + .treatmentParameters.getFormatByCategoryMap() + .entrySet() + .stream() + .flatMap(e -> e.getValue().stream()) + .collect(Collectors.toList()); this.formats.remove("Other"); } else { this.searchOthers = false; @@ -97,32 +101,27 @@ public TechnicalSearchThread(ArchiveUnit au, List formats, long min, lon this.allFormatsFlag = ((formats.size() == 0) && !this.searchOthers); this.min = min; this.max = max; - this.callBack=callBack; + this.callBack = callBack; } private void addBinaryDataObject(ArchiveUnit au, BinaryDataObject bdo) { List bdos = searchDataObjectResult.get(au); - if (bdos == null) - bdos = new ArrayList(); + if (bdos == null) bdos = new ArrayList(); bdos.add(bdo); searchDataObjectResult.put(au, bdos); } private boolean testBinaryDataObject(BinaryDataObject bdo) { - IntegerType size=bdo.getMetadataSize(); - if ((size == null) && ((min != 0) || (max != Long.MAX_VALUE))) - return false; - if (((min != 0) || (max != Long.MAX_VALUE)) && (size.getValue() < min) || (size.getValue() > max)) - return false; - if (allFormatsFlag) - return true; - FormatIdentification formatIdentification=bdo.getMetadataFormatIdentification(); - if (formatIdentification==null) - return false; - if (formats.contains(formatIdentification.getSimpleMetadata("FormatId"))) - return true; - if (searchOthers && !otherFormats.contains(formatIdentification.getSimpleMetadata("FormatId"))) - return true; + IntegerType size = bdo.getMetadataSize(); + if ((size == null) && ((min != 0) || (max != Long.MAX_VALUE))) return false; + if ( + (((min != 0) || (max != Long.MAX_VALUE)) && (size.getValue() < min)) || (size.getValue() > max) + ) return false; + if (allFormatsFlag) return true; + FormatIdentification formatIdentification = bdo.getMetadataFormatIdentification(); + if (formatIdentification == null) return false; + if (formats.contains(formatIdentification.getSimpleMetadata("FormatId"))) return true; + if (searchOthers && !otherFormats.contains(formatIdentification.getSimpleMetadata("FormatId"))) return true; return false; } @@ -130,20 +129,15 @@ private void searchInArchiveUnit(ArchiveUnit au) { List auList = au.getChildrenAuList().getArchiveUnitList(); for (ArchiveUnit childUnit : auList) { - if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) - continue; + if (dataObjectPackage.isTouchedInDataObjectPackageId(childUnit.getInDataObjectPackageId())) continue; for (DataObject dataObject : childUnit.getDataObjectRefList().getDataObjectList()) { - if (dataObject instanceof PhysicalDataObject) - continue; + if (dataObject instanceof PhysicalDataObject) continue; else if (dataObject instanceof BinaryDataObject) { BinaryDataObject bdo = (BinaryDataObject) dataObject; - if (testBinaryDataObject(bdo)) - addBinaryDataObject(childUnit, bdo); - + if (testBinaryDataObject(bdo)) addBinaryDataObject(childUnit, bdo); } else if (dataObject instanceof DataObjectGroup) { for (BinaryDataObject bdo : ((DataObjectGroup) dataObject).getBinaryDataObjectList()) { - if (testBinaryDataObject(bdo)) - addBinaryDataObject(childUnit, bdo); + if (testBinaryDataObject(bdo)) addBinaryDataObject(childUnit, bdo); } } } @@ -155,7 +149,7 @@ else if (dataObject instanceof BinaryDataObject) { @Override public String doInBackground() { - dataObjectPackage =searchUnit.getDataObjectPackage(); + dataObjectPackage = searchUnit.getDataObjectPackage(); dataObjectPackage.resetTouchedInDataObjectPackageIdMap(); searchDataObjectResult = new LinkedHashMap>(); diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java index f2dfb9c4..de1cb431 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/threads/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.threads; \ No newline at end of file +package fr.gouv.vitam.tools.resip.threads; diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java index 7ecbab4b..58cc605d 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipException.java @@ -53,8 +53,8 @@ public class ResipException extends Exception { * Instantiates a new validation exception. */ public ResipException() { - super(); - } + super(); + } /** * Instantiates a new validation exception. @@ -62,8 +62,8 @@ public ResipException() { * @param message the message */ public ResipException(String message) { - super(message); - } + super(message); + } /** * Instantiates a new validation exception. @@ -71,8 +71,8 @@ public ResipException(String message) { * @param cause the cause */ public ResipException(Throwable cause) { - super(cause); - } + super(cause); + } /** * Instantiates a new validation exception. @@ -81,8 +81,8 @@ public ResipException(Throwable cause) { * @param cause the cause */ public ResipException(String message, Throwable cause) { - super(message, cause); - } + super(message, cause); + } /** * Instantiates a new validation exception. @@ -93,7 +93,6 @@ public ResipException(String message, Throwable cause) { * @param writableStackTrace the writable stack trace */ public ResipException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java index 113c4811..0ae18397 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/ResipLogger.java @@ -59,7 +59,7 @@ public class ResipLogger { /** * The constant ERROR. */ -//** ProgressLog level. */ + //** ProgressLog level. */ public static final int ERROR = 0; /** * The constant ERROR_MARKER. @@ -132,12 +132,13 @@ public class ResipLogger { * @return the app logger */ public static ResipLogger getGlobalLogger() { - if (globalLogger == null) - globalLogger = new ResipLogger(LoggerFactory.getLogger(ResipApp.class.getSimpleName()), GLOBAL); + if (globalLogger == null) globalLogger = new ResipLogger( + LoggerFactory.getLogger(ResipApp.class.getSimpleName()), + GLOBAL + ); return globalLogger; } - /** * Instantiates a new Resip logger. * @@ -179,11 +180,13 @@ public static void createGlobalLogger(String logPath, int progressLogLevel) { PatternLayoutEncoder consoleEncoder = new PatternLayoutEncoder(); consoleEncoder.setContext(logCtx); - consoleEncoder.setPattern("%d{HH:mm:ss.SSS} [" + ResipApp.class.getSimpleName() + "] %-5level %marker - %msg%n"); - if (System.getProperty("os.name").toLowerCase().contains("win")) - consoleEncoder.setCharset(Charset.forName("cp850")); - else - consoleEncoder.setCharset(Charset.forName("UTF-8")); + consoleEncoder.setPattern( + "%d{HH:mm:ss.SSS} [" + ResipApp.class.getSimpleName() + "] %-5level %marker - %msg%n" + ); + if (System.getProperty("os.name").toLowerCase().contains("win")) consoleEncoder.setCharset( + Charset.forName("cp850") + ); + else consoleEncoder.setCharset(Charset.forName("UTF-8")); consoleEncoder.start(); ConsoleAppender logConsoleAppender = new ConsoleAppender<>(); @@ -198,7 +201,9 @@ public static void createGlobalLogger(String logPath, int progressLogLevel) { fileEncoder.setCharset(Charset.forName("UTF-8")); fileEncoder.start(); - FileAppender logFileAppender = new FileAppender(); + FileAppender logFileAppender = new FileAppender< + ch.qos.logback.classic.spi.ILoggingEvent + >(); logFileAppender.setContext(logCtx); logFileAppender.setName("logFile"); logFileAppender.setEncoder(fileEncoder); @@ -211,8 +216,7 @@ public static void createGlobalLogger(String logPath, int progressLogLevel) { log.addAppender(logConsoleAppender); log.addAppender(logFileAppender); - if (globalLogger != null) - globalLogger.close(); + if (globalLogger != null) globalLogger.close(); globalLogger = new ResipLogger(log, progressLogLevel); } @@ -224,20 +228,13 @@ public static void createGlobalLogger(String logPath, int progressLogLevel) { * @throws ResipException the resip exception */ public static int getLevel(String levelName) throws ResipException { - if (levelName.equals("OFF")) - return -1; - else if (levelName.equals(ERROR_MARKER.getName())) - return ERROR; - else if (levelName.equals(GLOBAL_MARKER.getName())) - return GLOBAL; - else if (levelName.equals(STEP_MARKER.getName())) - return STEP; - else if (levelName.equals(OBJECTS_GROUP_MARKER.getName())) - return OBJECTS_GROUP; - else if (levelName.equals(OBJECTS_MARKER.getName())) - return OBJECTS; - else if (levelName.equals(OBJECTS_WARNINGS_MARKER.getName())) - return OBJECTS_WARNINGS; + if (levelName.equals("OFF")) return -1; + else if (levelName.equals(ERROR_MARKER.getName())) return ERROR; + else if (levelName.equals(GLOBAL_MARKER.getName())) return GLOBAL; + else if (levelName.equals(STEP_MARKER.getName())) return STEP; + else if (levelName.equals(OBJECTS_GROUP_MARKER.getName())) return OBJECTS_GROUP; + else if (levelName.equals(OBJECTS_MARKER.getName())) return OBJECTS; + else if (levelName.equals(OBJECTS_WARNINGS_MARKER.getName())) return OBJECTS_WARNINGS; throw new ResipException("Niveau de log inconnu"); } @@ -271,15 +268,14 @@ public static Marker getMarker(int level) { * @param e the exception * @return the messages stack string */ - static public String getMessagesStackString(Throwable e) { + public static String getMessagesStackString(Throwable e) { String result; result = "-> " + e.getMessage(); - if (e.getCause() instanceof Exception) - result += "\n" + getMessagesStackString((Exception) e.getCause()); + if (e.getCause() instanceof Exception) result += "\n" + getMessagesStackString((Exception) e.getCause()); return result; } - static private String getJavaStackString(Throwable e) { + private static String getJavaStackString(Throwable e) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); e.printStackTrace(ps); @@ -292,11 +288,11 @@ static private String getJavaStackString(Throwable e) { * @param e the exception * @return the all java stack string */ - static public String getAllJavaStackString(Throwable e) { + public static String getAllJavaStackString(Throwable e) { String result; result = getJavaStackString(e); - if (e.getCause() instanceof Exception) - result += "\n------------------------------------\n" + getJavaStackString((Exception) e.getCause()); + if (e.getCause() instanceof Exception) result += + "\n------------------------------------\n" + getJavaStackString((Exception) e.getCause()); return result; } @@ -310,8 +306,7 @@ static public String getAllJavaStackString(Throwable e) { public void log(int level, String message, Throwable e) { if (level <= progressLogLevel) { if (logger != null) { - if (level >= GLOBAL) - logger.info(getMarker(level), message); + if (level >= GLOBAL) logger.info(getMarker(level), message); else { if (e != null) { message += "\n" + getMessagesStackString(e); @@ -335,8 +330,7 @@ public void logIfDebug(String message, Throwable e) { message += "\n" + getMessagesStackString(e); message += "\n" + getAllJavaStackString(e); logger.error(ERROR_MARKER, message); - } else - logger.info(message); + } else logger.info(message); } } @@ -362,7 +356,8 @@ public int getProgressLogLevel() { * Close. */ public void close() { - if (logger instanceof ch.qos.logback.classic.Logger) - ((ch.qos.logback.classic.Logger) logger).detachAndStopAllAppenders(); + if ( + logger instanceof ch.qos.logback.classic.Logger + ) ((ch.qos.logback.classic.Logger) logger).detachAndStopAllAppenders(); } } diff --git a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java index 7191c2b6..1ba17cfe 100644 --- a/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java +++ b/resip/src/main/java/fr/gouv/vitam/tools/resip/utils/package-info.java @@ -35,4 +35,4 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -package fr.gouv.vitam.tools.resip.utils; \ No newline at end of file +package fr.gouv.vitam.tools.resip.utils; diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java index 84d19587..53c10f13 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/TestUtilities.java @@ -58,43 +58,38 @@ private static void createSymbolicLink(String link, String target) throws ResipE Path targetpath = Paths.get(target); try { Files.delete(linkpath); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { - Files.delete(Paths.get(linkpath.toString()+".lnk")); - } catch (Exception ignored) { - } + Files.delete(Paths.get(linkpath.toString() + ".lnk")); + } catch (Exception ignored) {} try { - Files.createSymbolicLink(linkpath.toAbsolutePath(), linkpath.toAbsolutePath().getParent().relativize(targetpath.toAbsolutePath())); + Files.createSymbolicLink( + linkpath.toAbsolutePath(), + linkpath.toAbsolutePath().getParent().relativize(targetpath.toAbsolutePath()) + ); } catch (Exception e) { if (isWindows) { - System.err.println( - "Link creation is impossible, Windows shortcut creation is tried"); + System.err.println("Link creation is impossible, Windows shortcut creation is tried"); ShellLink sl = new ShellLink(); sl.setTarget(target); try { sl.saveTo(link + ".lnk"); } catch (IOException e1) { throw new ResipException( - "Link and Windows shortcut [" + link + "] creation impossible\n->" + e.getMessage()); + "Link and Windows shortcut [" + link + "] creation impossible\n->" + e.getMessage() + ); } - } - else - throw new ResipException( - "Link [" + link + "] creation impossible\n->" + e.getMessage()); + } else throw new ResipException("Link [" + link + "] creation impossible\n->" + e.getMessage()); } } - private static void createShortcutIfWindows(String link, String target) - throws IOException, ResipException { - if (!isWindows) - createSymbolicLink(link, target); + private static void createShortcutIfWindows(String link, String target) throws IOException, ResipException { + if (!isWindows) createSymbolicLink(link, target); else { Path linkpath = Paths.get(link); try { Files.delete(linkpath); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} ShellLink sl = new ShellLink(); sl.setTarget(target); sl.saveTo(link); @@ -110,22 +105,29 @@ private static void createShortcutIfWindows(String link, String target) static void ContructTestFiles() throws IOException, ResipException { if (!isPrepared) { String prefix; - isWindows=System.getProperty("os.name").toLowerCase().contains("win"); - + isWindows = System.getProperty("os.name").toLowerCase().contains("win"); prefix = "src/test/resources/PacketSamples/SampleWithLinksModelV2/Root/"; // regenerate PacketSamples.SampleWithWindowsLinksAndShortcutsModelV2 links createSymbolicLink(prefix + "Link Node 1.2", prefix + "Node 1/Node 1.2"); - createSymbolicLink(prefix + "Link SmallContract.text", - prefix + "Node 2/Node 2.3 - Many/SmallContract.text"); + createSymbolicLink( + prefix + "Link SmallContract.text", + prefix + "Node 2/Node 2.3 - Many/SmallContract.text" + ); createShortcutIfWindows(prefix + "Shortcut Node 2.4 - OG Link.lnk", prefix + "Node 2/Node 2.4 - OG Link"); - createShortcutIfWindows(prefix + "ShortCut OK-RULES-MDRULES.zip.lnk", - prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip"); - createSymbolicLink(prefix + "Node 2/Node 2.4 - OG Link/Link ##Test ObjectGroup##", - prefix + "Node 1/##Test ObjectGroup##"); - createShortcutIfWindows(prefix + "Node 2/Node 2.5 - OG Shortcut/Shortcut ##Test ObjectGroup##.lnk", - prefix + "Node 1/##Test ObjectGroup##"); - System.err.println("Test files with links in ["+prefix+"] prepared"); + createShortcutIfWindows( + prefix + "ShortCut OK-RULES-MDRULES.zip.lnk", + prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip" + ); + createSymbolicLink( + prefix + "Node 2/Node 2.4 - OG Link/Link ##Test ObjectGroup##", + prefix + "Node 1/##Test ObjectGroup##" + ); + createShortcutIfWindows( + prefix + "Node 2/Node 2.5 - OG Shortcut/Shortcut ##Test ObjectGroup##.lnk", + prefix + "Node 1/##Test ObjectGroup##" + ); + System.err.println("Test files with links in [" + prefix + "] prepared"); isPrepared = true; } } @@ -136,7 +138,7 @@ static void ContructTestFiles() throws IOException, ResipException { * @param text the text * @return the string */ -// Utility function to get rid of line-ending differences and enbaling cross-platform compilation + // Utility function to get rid of line-ending differences and enbaling cross-platform compilation public static String LineEndNormalize(String text) { StringBuilder sb = new StringBuilder(); boolean inString = false; @@ -144,15 +146,12 @@ public static String LineEndNormalize(String text) { char[] chars = text.toCharArray(); for (int i = 0, n = chars.length; i < n; i++) { char c = chars[i]; - if (c == '"') - inString = !inString; + if (c == '"') inString = !inString; else if (c == '\\') { - if ((inString) && (chars[i + 1] == '\\')) - i++; + if ((inString) && (chars[i + 1] == '\\')) i++; i++; continue; - } else if (!inString && Character.isWhitespace(c) && c!='\n') - continue; + } else if (!inString && Character.isWhitespace(c) && c != '\n') continue; sb.append(c); } return sb.toString(); diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java index 2d9d1331..06a2c89f 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/UseTestFiles.java @@ -49,7 +49,6 @@ * The interface Use test files. */ public interface UseTestFiles { - /** * Initialize test files. * diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java index d3115d14..3d414824 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/ExportContextTest.java @@ -59,20 +59,23 @@ class ExportContextTest { * @throws Exception the exception */ @Test - void test() throws Exception { - ExportContext gmc=new ExportContext(); - gmc.setDefaultPrefs(); - - // create jackson object mapper - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + void test() throws Exception { + ExportContext gmc = new ExportContext(); + gmc.setDefaultPrefs(); - String ssc = mapper.writeValueAsString(gmc); - ExportContext reloadSipContext=mapper.readValue(ssc, ExportContext.class); - String dssc = mapper.writeValueAsString(reloadSipContext); - - String fromfile = new String(Files.readAllBytes(Paths.get("src/test/resources/PacketSamples/ExportContext.config")), StandardCharsets.UTF_8); - - assertThat(TestUtilities.LineEndNormalize(dssc)).isEqualTo(TestUtilities.LineEndNormalize(fromfile)); - } + // create jackson object mapper + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + String ssc = mapper.writeValueAsString(gmc); + ExportContext reloadSipContext = mapper.readValue(ssc, ExportContext.class); + String dssc = mapper.writeValueAsString(reloadSipContext); + + String fromfile = new String( + Files.readAllBytes(Paths.get("src/test/resources/PacketSamples/ExportContext.config")), + StandardCharsets.UTF_8 + ); + + assertThat(TestUtilities.LineEndNormalize(dssc)).isEqualTo(TestUtilities.LineEndNormalize(fromfile)); + } } diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java index 4b5e694f..d60a404a 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/parameters/WorkTest.java @@ -67,69 +67,78 @@ */ class WorkTest implements UseTestFiles { - private void setWorkFromArchiveTransfer(Work work, ArchiveTransfer archiveTransfer) { - work.setDataObjectPackage(archiveTransfer.getDataObjectPackage()); - ExportContext newExportContext = new ExportContext(); + private void setWorkFromArchiveTransfer(Work work, ArchiveTransfer archiveTransfer) { + work.setDataObjectPackage(archiveTransfer.getDataObjectPackage()); + ExportContext newExportContext = new ExportContext(); newExportContext.setDefaultPrefs(); - newExportContext.setArchiveTransferGlobalMetadata(archiveTransfer.getGlobalMetadata()); - newExportContext.setManagementMetadataXmlData( - archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData()); - work.setExportContext(newExportContext); - } + newExportContext.setArchiveTransferGlobalMetadata(archiveTransfer.getGlobalMetadata()); + newExportContext.setManagementMetadataXmlData( + archiveTransfer.getDataObjectPackage().getManagementMetadataXmlData() + ); + work.setExportContext(newExportContext); + } - /** - * Test resip work serialization deserialization. - * - * @throws ResipException the resip exception - * @throws FileNotFoundException the file not found exception - * @throws IOException the io exception - * @throws InterruptedException the interrupted exception - * @throws SEDALibException the seda lib exception - */ - @Test - void TestResipWorkSerializationDeserialization() throws ResipException, FileNotFoundException, IOException, InterruptedException, SEDALibException { - String destLog = "./target/tmpJunit/" + File.separator + "junit_log.log"; + /** + * Test resip work serialization deserialization. + * + * @throws ResipException the resip exception + * @throws FileNotFoundException the file not found exception + * @throws IOException the io exception + * @throws InterruptedException the interrupted exception + * @throws SEDALibException the seda lib exception + */ + @Test + void TestResipWorkSerializationDeserialization() + throws ResipException, FileNotFoundException, IOException, InterruptedException, SEDALibException { + String destLog = "./target/tmpJunit/" + File.separator + "junit_log.log"; - SEDALibProgressLogger spl= new SEDALibProgressLogger(ResipLogger.getGlobalLogger().getLogger(), SEDALibProgressLogger.OBJECTS_GROUP); - - List ignorePatternList=new ArrayList<>(2); - ignorePatternList.add("Thumbs.db"); - ignorePatternList.add("pagefile.sys"); - ExportContext gmc=new ExportContext("src/test/resources/PacketSamples/ExportContext.config"); - CreationContext oic=new DiskImportContext(ignorePatternList,false, "src/test/resources/PacketSamples/SampleWithoutLinksModelV2", destLog); - Work ow = new Work(null, oic, gmc); + SEDALibProgressLogger spl = new SEDALibProgressLogger( + ResipLogger.getGlobalLogger().getLogger(), + SEDALibProgressLogger.OBJECTS_GROUP + ); - DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter(ow.getCreationContext().getOnDiskInput(), - spl); - for (String ip : ((DiskImportContext) ow.getCreationContext()).getIgnorePatternList()) - di.addIgnorePattern(ip); - di.doImport(); - ((DiskImportContext) ow.getCreationContext()).setModelVersion(di.getModelVersion()); - setWorkFromArchiveTransfer(ow,di.getArchiveTransfer()); + List ignorePatternList = new ArrayList<>(2); + ignorePatternList.add("Thumbs.db"); + ignorePatternList.add("pagefile.sys"); + ExportContext gmc = new ExportContext("src/test/resources/PacketSamples/ExportContext.config"); + CreationContext oic = new DiskImportContext( + ignorePatternList, + false, + "src/test/resources/PacketSamples/SampleWithoutLinksModelV2", + destLog + ); + Work ow = new Work(null, oic, gmc); - // assert macro results - assertEquals(22,ow.getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); - assertEquals(11,ow.getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + ow.getCreationContext().getOnDiskInput(), + spl + ); + for (String ip : ((DiskImportContext) ow.getCreationContext()).getIgnorePatternList()) di.addIgnorePattern(ip); + di.doImport(); + ((DiskImportContext) ow.getCreationContext()).setModelVersion(di.getModelVersion()); + setWorkFromArchiveTransfer(ow, di.getArchiveTransfer()); - // create jackson object mapper - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + // assert macro results + assertEquals(22, ow.getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); + assertEquals(11, ow.getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); - String s= mapper.writeValueAsString(gmc); - System.out.println(s); + // create jackson object mapper + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - // assert archiveTransfer serialization/deserialization - String ssip = mapper.writeValueAsString(ow); - mapper.writeValue(new FileOutputStream("./target/tmpJunit/junit_resiptWork.json"), ow); - Work dssip = mapper.readValue(ssip, Work.class); - String sdssip = mapper.writeValueAsString(dssip); - mapper.writeValue(new FileOutputStream("./target/tmpJunit/junit_resiptWork_after.json"), dssip); - assertEquals(ssip,sdssip); - - } + String s = mapper.writeValueAsString(gmc); + System.out.println(s); + // assert archiveTransfer serialization/deserialization + String ssip = mapper.writeValueAsString(ow); + mapper.writeValue(new FileOutputStream("./target/tmpJunit/junit_resiptWork.json"), ow); + Work dssip = mapper.readValue(ssip, Work.class); + String sdssip = mapper.writeValueAsString(dssip); + mapper.writeValue(new FileOutputStream("./target/tmpJunit/junit_resiptWork_after.json"), dssip); + assertEquals(ssip, sdssip); + } } diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java index 2e3b41e0..f2dbd77a 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/AllMetadataEditorTest.java @@ -45,13 +45,13 @@ public class AllMetadataEditorTest { - static String[] demoMetadataTypes = {"ArchiveUnitProfile", "Management", "Content","PhysicalDimensions"}; + static String[] demoMetadataTypes = { "ArchiveUnitProfile", "Management", "Content", "PhysicalDimensions" }; public static void main(String[] args) throws Exception { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); JDialog dialog = new JDialog(); dialog.setMinimumSize(new Dimension(600, 800)); @@ -68,9 +68,16 @@ public static void main(String[] args) throws Exception { int i; for (i = 0; i < demoMetadataTypes.length; i++) { - SEDAObjectEditor objectEditor = SEDAObjectEditor.createSEDAObjectEditor(demoMetadataTypes[i], demoMetadataTypes[i] + "Name", false, null); - if (objectEditor instanceof ComplexListTypeEditor) - ((ComplexListTypeEditor) objectEditor).doExpand(true, false); + SEDAObjectEditor objectEditor = SEDAObjectEditor.createSEDAObjectEditor( + demoMetadataTypes[i], + demoMetadataTypes[i] + "Name", + false, + null + ); + if (objectEditor instanceof ComplexListTypeEditor) ((ComplexListTypeEditor) objectEditor).doExpand( + true, + false + ); contentPane.add(objectEditor.getSEDAObjectEditorPanel()); } dialog.setVisible(true); diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java index 84ce4595..7a5ce2fd 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/DataObjectGroupEditorTest.java @@ -50,85 +50,87 @@ public class DataObjectGroupEditorTest { public static void main(String[] args) throws Exception { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); JDialog dialog = new JDialog(); dialog.setMinimumSize(new Dimension(600, 600)); dialog.setPreferredSize(new Dimension(600, 600)); - GridBagLayout gbl=new GridBagLayout(); - ScrollablePanel content=new ScrollablePanel(gbl); + GridBagLayout gbl = new GridBagLayout(); + ScrollablePanel content = new ScrollablePanel(gbl); content.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT); content.setScrollableHeight(ScrollablePanel.ScrollableSizeHint.NONE); - DataObjectPackage dop=new DataObjectPackage(); - String bdoXML = "BinaryMaster_1\n" + - " content/ID52.jpg\n" + - " e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\n" + - " 21232\n" + - " \n" + - " Exchangeable Image File Format (Compressed)\n" + - " image/jpeg\n" + - " fmt/645\n" + - " \n" + - " \n" + - " image001.jpg\n" + - " 2018-08-28T19:22:19\n" + - " \n" + - " \n" + - " \n" + - " 117x76\n" + - " 117px\n" + - " 76px\n" + - " 96ppp\n" + - " 96ppp\n" + - " 24\n" + - " \n" + - " "; - BinaryDataObject bdo=new BinaryDataObject(dop); + DataObjectPackage dop = new DataObjectPackage(); + String bdoXML = + "BinaryMaster_1\n" + + " content/ID52.jpg\n" + + " e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\n" + + " 21232\n" + + " \n" + + " Exchangeable Image File Format (Compressed)\n" + + " image/jpeg\n" + + " fmt/645\n" + + " \n" + + " \n" + + " image001.jpg\n" + + " 2018-08-28T19:22:19\n" + + " \n" + + " \n" + + " \n" + + " 117x76\n" + + " 117px\n" + + " 76px\n" + + " 96ppp\n" + + " 96ppp\n" + + " 24\n" + + " \n" + + " "; + BinaryDataObject bdo = new BinaryDataObject(dop); bdo.fromSedaXmlFragments(bdoXML); bdo.setInDataObjectPackageId("TestID"); - BinaryDataObjectEditor bdoe=new BinaryDataObjectEditor(bdo,null); + BinaryDataObjectEditor bdoe = new BinaryDataObjectEditor(bdo, null); bdoe.doExpand(true, false); - GridBagConstraints gbc=new GridBagConstraints(); - gbc.fill=GridBagConstraints.HORIZONTAL; - gbc.weightx=1.0; - gbc.gridx=0; - gbc.gridy=0; - content.add(bdoe.sedaObjectEditorPanel,gbc); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.weightx = 1.0; + gbc.gridx = 0; + gbc.gridy = 0; + content.add(bdoe.sedaObjectEditorPanel, gbc); - String pdoXML = "PhysicalMaster_1\n" + - "940 W\n" + - "\n" + - " 10.0\n" + - " 8.0\n" + - " 1.0\n" + - " 0.0\n" + - " 59.0\n" + - "\n" + - "1carteimprimée\n" + - "10,5cmx14,8cm\n" + - "Noiretblanc\n" + - "Paysage\n" + - "Phototypie"; - PhysicalDataObject pdo=new PhysicalDataObject(dop); + String pdoXML = + "PhysicalMaster_1\n" + + "940 W\n" + + "\n" + + " 10.0\n" + + " 8.0\n" + + " 1.0\n" + + " 0.0\n" + + " 59.0\n" + + "\n" + + "1carteimprimée\n" + + "10,5cmx14,8cm\n" + + "Noiretblanc\n" + + "Paysage\n" + + "Phototypie"; + PhysicalDataObject pdo = new PhysicalDataObject(dop); pdo.fromSedaXmlFragments(pdoXML); pdo.setInDataObjectPackageId("TestID"); - PhysicalDataObjectEditor pdoe=new PhysicalDataObjectEditor(pdo,null); + PhysicalDataObjectEditor pdoe = new PhysicalDataObjectEditor(pdo, null); pdoe.doExpand(true, false); - gbc=new GridBagConstraints(); - gbc.fill=GridBagConstraints.HORIZONTAL; - gbc.weightx=1.0; - gbc.gridx=0; - gbc.gridy=1; - content.add(pdoe.sedaObjectEditorPanel,gbc); + gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.weightx = 1.0; + gbc.gridx = 0; + gbc.gridy = 1; + content.add(pdoe.sedaObjectEditorPanel, gbc); - JScrollPane scrollPane=new JScrollPane(content); + JScrollPane scrollPane = new JScrollPane(content); dialog.setContentPane(scrollPane); dialog.setVisible(true); } diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java index a19d5d45..7d728042 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredArchiveUnitEditorPanelTest.java @@ -51,29 +51,29 @@ public class StructuredArchiveUnitEditorPanelTest { public static void main(String[] args) throws Exception { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); JDialog dialog = new JDialog(); dialog.setMinimumSize(new Dimension(600, 600)); dialog.setPreferredSize(new Dimension(600, 600)); - DataObjectPackage dop=new DataObjectPackage(); - ArchiveUnit archiveUnit=new ArchiveUnit(); + DataObjectPackage dop = new DataObjectPackage(); + ArchiveUnit archiveUnit = new ArchiveUnit(); SEDAMetadata sedaMetadata; archiveUnit.setInDataObjectPackageId("TestID"); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("ArchiveUnitProfile","ArchiveUnitProfile",true); - archiveUnit.setArchiveUnitProfile((ArchiveUnitProfile)sedaMetadata); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("Content","Content",true); - archiveUnit.setContent((Content)sedaMetadata); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("Management","Management",true); - archiveUnit.setManagement((Management)sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("ArchiveUnitProfile", "ArchiveUnitProfile", true); + archiveUnit.setArchiveUnitProfile((ArchiveUnitProfile) sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("Content", "Content", true); + archiveUnit.setContent((Content) sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("Management", "Management", true); + archiveUnit.setManagement((Management) sedaMetadata); dop.addArchiveUnit(archiveUnit); - StructuredArchiveUnitEditorPanel sauep=new StructuredArchiveUnitEditorPanel(); + StructuredArchiveUnitEditorPanel sauep = new StructuredArchiveUnitEditorPanel(); sauep.editArchiveUnit(archiveUnit); dialog.setContentPane(sauep); diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java index 7a2bb2d8..abe667e5 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/StructuredDataObjectGroupEditorPanelTest.java @@ -51,10 +51,10 @@ public class StructuredDataObjectGroupEditorPanelTest { public static void main(String[] args) throws Exception { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); @@ -63,13 +63,18 @@ public static void main(String[] args) throws Exception { dialog.setMinimumSize(new Dimension(600, 600)); dialog.setPreferredSize(new Dimension(600, 600)); - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter("sedalib/src/test/resources/PacketSamples/TestSipDogMerge.zip", - "target/tmpJunit/TestSipDogMerge.zip-tmpdir", null); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + "sedalib/src/test/resources/PacketSamples/TestSipDogMerge.zip", + "target/tmpJunit/TestSipDogMerge.zip-tmpdir", + null + ); si.doImport(); - ArchiveUnit au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap() - .get("ID21"); - DataObjectGroup dog = si.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap() - .get("ID16"); + ArchiveUnit au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID21"); + DataObjectGroup dog = si + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID16"); StructuredDataObjectGroupEditorPanel sdogep = new StructuredDataObjectGroupEditorPanel(); sdogep.editDataObjectGroup(au); diff --git a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java index 679d0cb7..817e4ee3 100644 --- a/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java +++ b/resip/src/test/java/fr/gouv/vitam/tools/resip/sedaobjecteditor/XMLArchiveUnitEditorPanelTest.java @@ -52,10 +52,10 @@ public class XMLArchiveUnitEditorPanelTest { public static void main(String[] args) throws Exception { - if (System.getProperty("os.name").toLowerCase().contains("win")) - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - else - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + if (System.getProperty("os.name").toLowerCase().contains("win")) UIManager.setLookAndFeel( + UIManager.getSystemLookAndFeelClassName() + ); + else UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); ResipGraphicApp rga = new ResipGraphicApp(null); Thread.sleep(1000); @@ -63,20 +63,20 @@ public static void main(String[] args) throws Exception { dialog.setMinimumSize(new Dimension(600, 600)); dialog.setPreferredSize(new Dimension(600, 600)); - DataObjectPackage dop=new DataObjectPackage(); - ArchiveUnit archiveUnit=new ArchiveUnit(); + DataObjectPackage dop = new DataObjectPackage(); + ArchiveUnit archiveUnit = new ArchiveUnit(); SEDAMetadata sedaMetadata; archiveUnit.setInDataObjectPackageId("TestID"); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("ArchiveUnitProfile","ArchiveUnitProfile",true); - archiveUnit.setArchiveUnitProfile((ArchiveUnitProfile)sedaMetadata); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("Content","Content",true); - archiveUnit.setContent((Content)sedaMetadata); - sedaMetadata= SEDAObjectEditor.createSEDAMetadataSample("Management","Management",true); - archiveUnit.setManagement((Management)sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("ArchiveUnitProfile", "ArchiveUnitProfile", true); + archiveUnit.setArchiveUnitProfile((ArchiveUnitProfile) sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("Content", "Content", true); + archiveUnit.setContent((Content) sedaMetadata); + sedaMetadata = SEDAObjectEditor.createSEDAMetadataSample("Management", "Management", true); + archiveUnit.setManagement((Management) sedaMetadata); dop.addArchiveUnit(archiveUnit); - XMLArchiveUnitEditorPanel xauep=new XMLArchiveUnitEditorPanel(); + XMLArchiveUnitEditorPanel xauep = new XMLArchiveUnitEditorPanel(); xauep.editArchiveUnit(archiveUnit); dialog.setContentPane(xauep); diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java index 3cce8747..a032287a 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/App.java @@ -42,21 +42,22 @@ * */ public class App { + public static void main(String[] args) throws Exception { -// Build a SIP from a disk hierarchy with no other treatment + // Build a SIP from a disk hierarchy with no other treatment Sample1.run(); -// Build a SIP from a disk hierarchy for a part and from affair files differentiated by their name + // Build a SIP from a disk hierarchy for a part and from affair files differentiated by their name Sample2.run(); -// Build a SIP from a disk hierarchy for a part and from affair files organized in a csv + // Build a SIP from a disk hierarchy for a part and from affair files organized in a csv Sample3.run(); -// Build a SIP from a disk hierarchy with more affair files organized in a csv and to add to existing archived files group + // Build a SIP from a disk hierarchy with more affair files organized in a csv and to add to existing archived files group Sample3plus.run(); -// Build a SIP from a disk hierarchy for a part and from affair files with hierarchy and metadata defined in a csv -// which is automatically interpreted + // Build a SIP from a disk hierarchy for a part and from affair files with hierarchy and metadata defined in a csv + // which is automatically interpreted Sample4.run(); } } diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java index ad6475c0..7f4ce194 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample1.java @@ -44,13 +44,20 @@ public class Sample1 { static void run() throws Exception { - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("sedalibsamples"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("sedalibsamples"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("sedalib-samples/samples/Sample1.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createRootArchiveUnit("Racine", "Subseries", "Procédure Cerfa-1244771", - "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " - + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)"); + sb.createRootArchiveUnit( + "Racine", + "Subseries", + "Procédure Cerfa-1244771", + "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " + + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)" + ); sb.addDiskSubTree("Racine", "sedalib-samples/src/main/resources/Procedure"); sb.generateSIP(); } diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java index 2facb55c..8990d11b 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample2.java @@ -56,28 +56,43 @@ public class Sample2 { - static private String stripFileName(String fileName) { + private static String stripFileName(String fileName) { String tmp = fileName.substring(fileName.indexOf("-") + 1); - if (tmp.lastIndexOf('.') >= 0) - return (tmp.substring(0, tmp.lastIndexOf('.'))); - else - return tmp; + if (tmp.lastIndexOf('.') >= 0) return (tmp.substring(0, tmp.lastIndexOf('.'))); + else return tmp; } static void run() throws Exception { - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("sedalibsamples"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("sedalibsamples"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("sedalib-samples/samples/Sample2.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createRootArchiveUnit("Racine", "Subseries", "Procédure Cerfa-1244771", - "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " - + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)"); + sb.createRootArchiveUnit( + "Racine", + "Subseries", + "Procédure Cerfa-1244771", + "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " + + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)" + ); - sb.addNewSubArchiveUnit("Racine", "Contexte", "RecordGrp", "Contexte", - "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771"); + sb.addNewSubArchiveUnit( + "Racine", + "Contexte", + "RecordGrp", + "Contexte", + "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771" + ); sb.addDiskSubTree("Contexte", "sedalib-samples/src/main/resources/Procedure/Contexte"); - sb.addNewSubArchiveUnit("Racine", "Dossiers", "RecordGrp", "Dossiers", - "Ensemble des dossiers archivés de la procédure Cerfa-1244771"); + sb.addNewSubArchiveUnit( + "Racine", + "Dossiers", + "RecordGrp", + "Dossiers", + "Ensemble des dossiers archivés de la procédure Cerfa-1244771" + ); // find proc IDs Path procDir = Paths.get("sedalib-samples/src/main/resources/Procedure/Dossiers"); @@ -88,40 +103,56 @@ static void run() throws Exception { while (pi.hasNext()) { Path path = pi.next(); String filename = path.getFileName().toString(); - if (!filename.matches("ID[0-9]+-.+")) - throw new SEDALibException("Fichier ne correspondant pas à un dossier"); + if (!filename.matches("ID[0-9]+-.+")) throw new SEDALibException( + "Fichier ne correspondant pas à un dossier" + ); String id = filename.substring(0, filename.indexOf("-")); - if (!procIdList.contains(id)) - procIdList.add(id); + if (!procIdList.contains(id)) procIdList.add(id); } } // construct proc archives with metadata in group ArchiveUnit for (String procId : procIdList) { - sb.addNewSubArchiveUnit("Dossiers", procId, "RecordGrp", procId, - "Ensemble des fichiers de dossier " + procId); - try (DirectoryStream ds = Files.newDirectoryStream(procDir, new DirectoryStream.Filter() { - @Override - public boolean accept(Path entry) throws IOException { - return entry.getFileName().toString().startsWith(procId); - } - })) { + sb.addNewSubArchiveUnit( + "Dossiers", + procId, + "RecordGrp", + procId, + "Ensemble des fichiers de dossier " + procId + ); + try ( + DirectoryStream ds = Files.newDirectoryStream( + procDir, + new DirectoryStream.Filter() { + @Override + public boolean accept(Path entry) throws IOException { + return entry.getFileName().toString().startsWith(procId); + } + } + ) + ) { for (Path p : ds) { if (p.getFileName().toString().endsWith(".xml")) { Content content = sb.getContent(procId); - content.addSedaXmlFragments(SEDAXMLEventReader.extractFragments("File", new String(Files.readAllBytes(p), "UTF-8"))); + content.addSedaXmlFragments( + SEDAXMLEventReader.extractFragments("File", new String(Files.readAllBytes(p), "UTF-8")) + ); sb.setContent(procId, content); - } else - sb.addFileSubArchiveUnit(procId, p.toString(), p.getFileName().toString(), "File", - stripFileName(p.getFileName().toString()), null); + } else sb.addFileSubArchiveUnit( + procId, + p.toString(), + p.getFileName().toString(), + "File", + stripFileName(p.getFileName().toString()), + null + ); } } catch (IOException ex) { ex.printStackTrace(); } - } sb.generateSIP(); } } -} \ No newline at end of file +} diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java index c76c659e..14c23954 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3.java @@ -59,28 +59,43 @@ public class Sample3 { - static private String stripFileName(String fileName) { + private static String stripFileName(String fileName) { String tmp = fileName.substring(fileName.indexOf("-") + 1); - if (tmp.lastIndexOf('.') >= 0) - return (tmp.substring(0, tmp.lastIndexOf('.'))); - else - return tmp; + if (tmp.lastIndexOf('.') >= 0) return (tmp.substring(0, tmp.lastIndexOf('.'))); + else return tmp; } static void run() throws Exception { - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("sedalibsamples"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("sedalibsamples"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("sedalib-samples/samples/Sample3.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createRootArchiveUnit("Racine", "Subseries", "Procédure Cerfa-1244771", - "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " - + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)"); + sb.createRootArchiveUnit( + "Racine", + "Subseries", + "Procédure Cerfa-1244771", + "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " + + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)" + ); - sb.addNewSubArchiveUnit("Racine", "Contexte", "RecordGrp", "Contexte", - "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771"); + sb.addNewSubArchiveUnit( + "Racine", + "Contexte", + "RecordGrp", + "Contexte", + "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771" + ); sb.addDiskSubTree("Contexte", "sedalib-samples/src/main/resources/Procedure/Contexte"); - sb.addNewSubArchiveUnit("Racine", "Dossiers", "RecordGrp", "Dossiers", - "Ensemble des dossiers archivés de la procédure Cerfa-1244771"); + sb.addNewSubArchiveUnit( + "Racine", + "Dossiers", + "RecordGrp", + "Dossiers", + "Ensemble des dossiers archivés de la procédure Cerfa-1244771" + ); sb.addNewContentMetadataInArchiveUnit("Dossiers", "FilePlanPosition", "Dossiers-Cerfa-1244771"); // iterate through csv @@ -100,8 +115,13 @@ static void run() throws Exception { procId = "Cerfa-1244771-" + id; // set metadata from csv on the procId ArchiveUnit - sb.addNewSubArchiveUnit("Dossiers", procId, "RecordGrp", procId, - "Ensemble des fichiers de dossier " + procId); + sb.addNewSubArchiveUnit( + "Dossiers", + procId, + "RecordGrp", + procId, + "Ensemble des fichiers de dossier " + procId + ); Content content = sb.getContent(procId); content.addNewMetadata("OriginatingSystemId", procId); content.addNewMetadata("RegisteredDate", registeredDate); @@ -124,16 +144,26 @@ static void run() throws Exception { sb.setManagement(procId, management); // put all proc files in the procId ArchiveUnit - try (DirectoryStream ds = Files.newDirectoryStream(procDir, new DirectoryStream.Filter() { - @Override - public boolean accept(Path entry) throws IOException { - return entry.getFileName().toString().startsWith(id); - } - })) { + try ( + DirectoryStream ds = Files.newDirectoryStream( + procDir, + new DirectoryStream.Filter() { + @Override + public boolean accept(Path entry) throws IOException { + return entry.getFileName().toString().startsWith(id); + } + } + ) + ) { for (Path p : ds) { - if (!p.getFileName().toString().endsWith(".xml")) - sb.addFileSubArchiveUnit(procId, p.toString(), p.getFileName().toString(), "File", - stripFileName(p.getFileName().toString()), null); + if (!p.getFileName().toString().endsWith(".xml")) sb.addFileSubArchiveUnit( + procId, + p.toString(), + p.getFileName().toString(), + "File", + stripFileName(p.getFileName().toString()), + null + ); } } catch (IOException ex) { ex.printStackTrace(); @@ -144,11 +174,16 @@ public boolean accept(Path entry) throws IOException { // keep last file for history in Contexte part and without AppraisalRuleOld if (procId != null) { Content c = sb.getContent(procId); - sb.addNewSubArchiveUnit("Contexte", "Exemple de dossier", - "RecordGrp", "Exemplaire de dossier", - "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:"+ - c.getSimpleMetadata("Title")+"\nDescription originale:"+ - c.getSimpleMetadata("Description")); + sb.addNewSubArchiveUnit( + "Contexte", + "Exemple de dossier", + "RecordGrp", + "Exemplaire de dossier", + "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:" + + c.getSimpleMetadata("Title") + + "\nDescription originale:" + + c.getSimpleMetadata("Description") + ); sb.addArchiveUnitSubTree("Exemple de dossier", procId); } diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java index 6d2a97c7..bfa111b1 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample3plus.java @@ -59,21 +59,27 @@ public class Sample3plus { - static private String stripFileName(String fileName) { + private static String stripFileName(String fileName) { String tmp = fileName.substring(fileName.indexOf("-") + 1); - if (tmp.lastIndexOf('.') >= 0) - return (tmp.substring(0, tmp.lastIndexOf('.'))); - else - return tmp; + if (tmp.lastIndexOf('.') >= 0) return (tmp.substring(0, tmp.lastIndexOf('.'))); + else return tmp; } static void run() throws Exception { - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("sedalibsamples"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("sedalibsamples"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("sedalib-samples/samples/Sample3plus.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createSystemExistingRootArchiveUnit("Dossiers", "FilePlanPosition", "Dossiers-Cerfa-1244771", - "RecordGrp", "Dossiers"); + sb.createSystemExistingRootArchiveUnit( + "Dossiers", + "FilePlanPosition", + "Dossiers-Cerfa-1244771", + "RecordGrp", + "Dossiers" + ); // iterate through csv Path procDir = Paths.get("sedalib-samples/src/main/resources/AutresDossiers"); @@ -92,8 +98,13 @@ static void run() throws Exception { procId = "Cerfa-1244771-" + id; // set metadata from csv on the procId ArchiveUnit - sb.addNewSubArchiveUnit("Dossiers", procId, "RecordGrp", procId, - "Ensemble des fichiers de dossier " + procId); + sb.addNewSubArchiveUnit( + "Dossiers", + procId, + "RecordGrp", + procId, + "Ensemble des fichiers de dossier " + procId + ); Content content = sb.getContent(procId); content.addNewMetadata("OriginatingSystemId", procId); content.addNewMetadata("RegisteredDate", registeredDate); @@ -116,16 +127,26 @@ static void run() throws Exception { sb.setManagement(procId, management); // put all proc files in the procId ArchiveUnit - try (DirectoryStream ds = Files.newDirectoryStream(procDir, new DirectoryStream.Filter() { - @Override - public boolean accept(Path entry) throws IOException { - return entry.getFileName().toString().startsWith(id); - } - })) { + try ( + DirectoryStream ds = Files.newDirectoryStream( + procDir, + new DirectoryStream.Filter() { + @Override + public boolean accept(Path entry) throws IOException { + return entry.getFileName().toString().startsWith(id); + } + } + ) + ) { for (Path p : ds) { - if (!p.getFileName().toString().endsWith(".xml")) - sb.addFileSubArchiveUnit(procId, p.toString(), p.getFileName().toString(), "File", - stripFileName(p.getFileName().toString()), null); + if (!p.getFileName().toString().endsWith(".xml")) sb.addFileSubArchiveUnit( + procId, + p.toString(), + p.getFileName().toString(), + "File", + stripFileName(p.getFileName().toString()), + null + ); } } catch (IOException ex) { ex.printStackTrace(); diff --git a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java index 605a996a..e537a091 100644 --- a/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java +++ b/sedalib-samples/src/main/java/fr/gouv/vitam/tools/sedalibsamples/Sample4.java @@ -46,27 +46,44 @@ public class Sample4 { static void run() throws Exception { - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("sedalibsamples"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("sedalibsamples"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("sedalib-samples/samples/Sample4.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createRootArchiveUnit("Racine", "Subseries", "Procédure Cerfa-1244771", - "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " - + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)"); + sb.createRootArchiveUnit( + "Racine", + "Subseries", + "Procédure Cerfa-1244771", + "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " + + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)" + ); - sb.addNewSubArchiveUnit("Racine", "Contexte", "RecordGrp", "Contexte", - "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771"); + sb.addNewSubArchiveUnit( + "Racine", + "Contexte", + "RecordGrp", + "Contexte", + "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771" + ); sb.addDiskSubTree("Contexte", "sedalib-samples/src/main/resources/Procedure/Contexte"); sb.addCSVMetadataSubTree("Racine", "Cp1252", ';', "sedalib-samples/src/main/resources/MetadataCSV.csv"); // keep one file for history in Contexte part and without AppraisalRule ArchiveUnit sampleAU = sb.findArchiveUnitBySimpleDescriptiveMetadata("OriginatingSystemId", "ID10000"); Content c = sb.getContent(sampleAU.getInDataObjectPackageId()); - sb.addNewSubArchiveUnit("Contexte", "Exemple de dossier", - "RecordGrp", "Exemplaire de dossier", - "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:" + - c.getSimpleMetadata("Title") + "\nDescription originale:" + - c.getSimpleMetadata("Description")); + sb.addNewSubArchiveUnit( + "Contexte", + "Exemple de dossier", + "RecordGrp", + "Exemplaire de dossier", + "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:" + + c.getSimpleMetadata("Title") + + "\nDescription originale:" + + c.getSimpleMetadata("Description") + ); sb.addArchiveUnitSubTree("Exemple de dossier", sampleAU.getInDataObjectPackageId()); sb.generateSIP(); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java index 484c2776..363061d1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/AbstractUnitaryDataObject.java @@ -63,7 +63,9 @@ *

    * Abstract class for SEDA unitary data objects (BinaryDataObject and PhysicalDataObject). It contains metadata. */ -abstract public class AbstractUnitaryDataObject extends DataObjectPackageIdElement implements DataObject, ComplexListInterface { +public abstract class AbstractUnitaryDataObject + extends DataObjectPackageIdElement + implements DataObject, ComplexListInterface { /** * The list of metadata elements associated with this object. @@ -122,15 +124,13 @@ public AbstractUnitaryDataObject() { */ public AbstractUnitaryDataObject(DataObjectPackage dataObjectPackage) { super(dataObjectPackage); - this.metadataList = new ArrayList<>(10); this.dataObjectGroup = null; - if (dataObjectPackage != null) - try { - dataObjectPackage.addDataObjectPackageIdElement(this); - } catch (SEDALibException e) { - // impossible as the uniqID is generated by the called function. - } + if (dataObjectPackage != null) try { + dataObjectPackage.addDataObjectPackageIdElement(this); + } catch (SEDALibException e) { + // impossible as the uniqID is generated by the called function. + } } // SEDA XML exporter @@ -143,7 +143,7 @@ public AbstractUnitaryDataObject(DataObjectPackage dataObjectPackage) { * sedalib.xml.SEDAXMLStreamWriter) */ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaLibProgressLogger) - throws InterruptedException, SEDALibException { + throws InterruptedException, SEDALibException { try { // XML write xmlWriter.writeStartElement(getXmlElementName()); @@ -152,12 +152,18 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaL xmlWriter.writeEndElement(); } catch (XMLStreamException e) { throw new SEDALibException( - "Erreur d'écriture XML du " + getXmlElementName() + " [" + inDataPackageObjectId + "]", e); + "Erreur d'écriture XML du " + getXmlElementName() + " [" + inDataPackageObjectId + "]", + e + ); } int counter = getDataObjectPackage().getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " métadonnées DataObject exportées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " métadonnées DataObject exportées" + ); } /** @@ -211,8 +217,7 @@ public String toSedaXmlFragments() throws SEDALibException { * @throws SEDALibException if the XML can't be read or the SEDA scheme is * not respected */ - private void setFromXmlContent(SEDAXMLEventReader xmlReader) - throws SEDALibException { + private void setFromXmlContent(SEDAXMLEventReader xmlReader) throws SEDALibException { try { metadataList = new ArrayList<>(18); fillFromSedaXmlMetadataList(xmlReader); @@ -233,8 +238,12 @@ private void setFromXmlContent(SEDAXMLEventReader xmlReader) * not respected * @throws InterruptedException if export process is interrupted */ - public static boolean importUnitaryDataObjectPackageIdElementFromSedaXml(AbstractUnitaryDataObject udo, SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static boolean importUnitaryDataObjectPackageIdElementFromSedaXml( + AbstractUnitaryDataObject udo, + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { DataObjectGroup dog; String tmp; try { @@ -247,36 +256,57 @@ public static boolean importUnitaryDataObjectPackageIdElementFromSedaXml(Abstrac xmlReader.endBlockNamed(udo.getXmlElementName()); } else return false; } catch (XMLStreamException e) { - throw new SEDALibException("Erreur de lecture XML du " + udo.getXmlElementName() - + (udo.inDataPackageObjectId != null ? " [" + udo.inDataPackageObjectId + "]" : ""), e); + throw new SEDALibException( + "Erreur de lecture XML du " + + udo.getXmlElementName() + + (udo.inDataPackageObjectId != null ? " [" + udo.inDataPackageObjectId + "]" : ""), + e + ); } StringType dataObjectGroupId = (StringType) udo.getFirstNamedMetadata("DataObjectGroupId"); StringType dataObjectGroupReferenceId = (StringType) udo.getFirstNamedMetadata("DataObjectGroupReferenceId"); - if ((dataObjectGroupId != null) && (dataObjectGroupReferenceId != null)) - throw new SEDALibException("Eléments DataObjectGroupReferenceId et DataObjectGroupId incompatibles"); + if ((dataObjectGroupId != null) && (dataObjectGroupReferenceId != null)) throw new SEDALibException( + "Eléments DataObjectGroupReferenceId et DataObjectGroupId incompatibles" + ); if (dataObjectGroupId != null) { - if (dataObjectPackage.getDataObjectGroupById(dataObjectGroupId.getValue()) != null) - throw new SEDALibException("Elément DataObjectGroup [" + dataObjectGroupId.getValue() + "] déjà créé"); + if ( + dataObjectPackage.getDataObjectGroupById(dataObjectGroupId.getValue()) != null + ) throw new SEDALibException("Elément DataObjectGroup [" + dataObjectGroupId.getValue() + "] déjà créé"); dog = new DataObjectGroup(); dog.setInDataObjectPackageId(dataObjectGroupId.getValue()); dataObjectPackage.addDataObjectGroup(dog); dog.addDataObject(udo); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_WARNINGS, "sedalib: dataObjectGroup [" + dog.inDataPackageObjectId - + "] créé depuis " + udo.getXmlElementName() + " [" + udo.inDataPackageObjectId + "]", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_WARNINGS, + "sedalib: dataObjectGroup [" + + dog.inDataPackageObjectId + + "] créé depuis " + + udo.getXmlElementName() + + " [" + + udo.inDataPackageObjectId + + "]", + null + ); } else if (dataObjectGroupReferenceId != null) { dog = dataObjectPackage.getDataObjectGroupById(dataObjectGroupReferenceId.getValue()); - if (dog == null) - throw new SEDALibException("Erreur de référence au DataObjectGroup [" + dataObjectGroupReferenceId.getValue() + "]"); + if (dog == null) throw new SEDALibException( + "Erreur de référence au DataObjectGroup [" + dataObjectGroupReferenceId.getValue() + "]" + ); dog.addDataObject(udo); } udo.removeFirstNamedMetadata("DataObjectGroupReferenceId"); udo.removeFirstNamedMetadata("DataObjectGroupId"); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " métadonnées DataObject importées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " métadonnées DataObject importées" + ); return true; } @@ -290,9 +320,10 @@ public AbstractUnitaryDataObject getEmptySameAbstractUnitaryDataObjet() throws S try { return this.getClass().getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { - throw new SEDALibException("Type de DataObject ["+getClass()+"] non géré",e); + throw new SEDALibException("Type de DataObject [" + getClass() + "] non géré", e); } } + /* * (non-Javadoc) * @@ -304,14 +335,15 @@ public AbstractUnitaryDataObject getEmptySameAbstractUnitaryDataObjet() throws S public void fromSedaXmlFragments(String fragments) throws SEDALibException { AbstractUnitaryDataObject udo = getEmptySameAbstractUnitaryDataObjet(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); udo.setFromXmlContent(xmlReader); XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new SEDALibException("Il y a des champs illégaux"); + if (!event.isEndDocument()) throw new SEDALibException("Il y a des champs illégaux"); } catch (XMLStreamException | SEDALibException | IOException e) { throw new SEDALibException("Erreur de lecture du " + getXmlElementName(), e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java index 49265435..f0ed8c97 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveDeliveryRequestReply.java @@ -145,13 +145,11 @@ public String getDescription() { * @param xmlReader the SEDAXMLEventReader reading the SEDA manifest * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importStartDocument(SEDAXMLEventReader xmlReader) - throws SEDALibException { + private static void importStartDocument(SEDAXMLEventReader xmlReader) throws SEDALibException { XMLEvent event; try { event = xmlReader.nextUsefullEvent(); - if (!event.isStartDocument()) - throw new SEDALibException("Pas de document XML"); + if (!event.isStartDocument()) throw new SEDALibException("Pas de document XML"); if (!xmlReader.nextBlockIfNamed("ArchiveDeliveryRequestReply")) { throw new SEDALibException("Pas d'élément ArchiveTransfer"); } @@ -171,23 +169,33 @@ private static void importStartDocument(SEDAXMLEventReader xmlReader) * @throws InterruptedException if interrupted */ - private static void importHeader(SEDAXMLEventReader xmlReader, - ArchiveDeliveryRequestReply archiveDeliveryRequestReply, - SEDALibProgressLogger sedaLibProgressLogger) throws InterruptedException { + private static void importHeader( + SEDAXMLEventReader xmlReader, + ArchiveDeliveryRequestReply archiveDeliveryRequestReply, + SEDALibProgressLogger sedaLibProgressLogger + ) throws InterruptedException { try { archiveDeliveryRequestReply.globalMetadata.comment = xmlReader.nextValueIfNamed("Comment"); archiveDeliveryRequestReply.globalMetadata.date = xmlReader.nextMandatoryValue("Date"); - archiveDeliveryRequestReply.globalMetadata - .messageIdentifier = xmlReader.nextMandatoryValue("MessageIdentifier"); - if (xmlReader.peekBlockIfNamed("Signature")) - throw new SEDALibException("L'élément Signature dans l'ArchiveTransfer n'est pas supporté"); - archiveDeliveryRequestReply.globalMetadata - .archivalAgreement = xmlReader.nextValueIfNamed("ArchivalAgreement"); - archiveDeliveryRequestReply.globalMetadata - .codeListVersionsXmlData = xmlReader.nextMandatoryBlockAsString("CodeListVersions"); + archiveDeliveryRequestReply.globalMetadata.messageIdentifier = xmlReader.nextMandatoryValue( + "MessageIdentifier" + ); + if (xmlReader.peekBlockIfNamed("Signature")) throw new SEDALibException( + "L'élément Signature dans l'ArchiveTransfer n'est pas supporté" + ); + archiveDeliveryRequestReply.globalMetadata.archivalAgreement = xmlReader.nextValueIfNamed( + "ArchivalAgreement" + ); + archiveDeliveryRequestReply.globalMetadata.codeListVersionsXmlData = xmlReader.nextMandatoryBlockAsString( + "CodeListVersions" + ); } catch (XMLStreamException | SEDALibException e) { - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.STEP, - "sedalib: l'entête n'est pas conforme à un ArchiveDeliveryRequestReply, mais la tentative d'analyse continue",null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: l'entête n'est pas conforme à un ArchiveDeliveryRequestReply, mais la tentative d'analyse continue", + null + ); archiveDeliveryRequestReply.globalMetadata = null; } } @@ -200,49 +208,108 @@ private static void importHeader(SEDAXMLEventReader xmlReader, * @param archiveDeliveryRequestReply the ArchiveTransfer to be completed * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importFooter(SEDAXMLEventReader xmlReader, - ArchiveDeliveryRequestReply archiveDeliveryRequestReply, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { //NOSONAR + private static void importFooter( + SEDAXMLEventReader xmlReader, + ArchiveDeliveryRequestReply archiveDeliveryRequestReply, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { //NOSONAR try { - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - "sedalib: début du bloc de fin spécifique du DIP", null); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + "sedalib: début du bloc de fin spécifique du DIP", + null + ); if (xmlReader.peekBlockIfNamed("ReplyCode")) { - archiveDeliveryRequestReply.replyCode = (StringType) SEDAMetadata.fromSedaXml(xmlReader, StringType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.replyCode.toString(), null); + archiveDeliveryRequestReply.replyCode = (StringType) SEDAMetadata.fromSedaXml( + xmlReader, + StringType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.replyCode.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("Operation")) { - archiveDeliveryRequestReply.operation = (Operation) SEDAMetadata.fromSedaXml(xmlReader, Operation.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.operation.toString(), null); + archiveDeliveryRequestReply.operation = (Operation) SEDAMetadata.fromSedaXml( + xmlReader, + Operation.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.operation.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("MessageRequestIdentifier")) { - archiveDeliveryRequestReply.messageRequestIdentifier = (StringType) SEDAMetadata.fromSedaXml(xmlReader, StringType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.messageRequestIdentifier.toString(), null); + archiveDeliveryRequestReply.messageRequestIdentifier = (StringType) SEDAMetadata.fromSedaXml( + xmlReader, + StringType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.messageRequestIdentifier.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("AuthorizationRequestReplyIdentifier")) { - archiveDeliveryRequestReply.authorizationRequestReplyIdentifier = (StringType) SEDAMetadata.fromSedaXml(xmlReader, StringType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.authorizationRequestReplyIdentifier.toString(), null); + archiveDeliveryRequestReply.authorizationRequestReplyIdentifier = (StringType) SEDAMetadata.fromSedaXml( + xmlReader, + StringType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.authorizationRequestReplyIdentifier.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("UnitIdentifier")) { - archiveDeliveryRequestReply.unitIdentifier = (StringType) SEDAMetadata.fromSedaXml(xmlReader, StringType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.unitIdentifier.toString(), null); + archiveDeliveryRequestReply.unitIdentifier = (StringType) SEDAMetadata.fromSedaXml( + xmlReader, + StringType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.unitIdentifier.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("ArchivalAgency")) { - archiveDeliveryRequestReply.archivalAgency = (InnerIdentifierType) SEDAMetadata.fromSedaXml(xmlReader, InnerIdentifierType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.archivalAgency.toString(), null); + archiveDeliveryRequestReply.archivalAgency = (InnerIdentifierType) SEDAMetadata.fromSedaXml( + xmlReader, + InnerIdentifierType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.archivalAgency.toString(), + null + ); } if (xmlReader.peekBlockIfNamed("Requester")) { - archiveDeliveryRequestReply.requester = (InnerIdentifierType) SEDAMetadata.fromSedaXml(xmlReader, InnerIdentifierType.class); - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - archiveDeliveryRequestReply.requester.toString(), null); + archiveDeliveryRequestReply.requester = (InnerIdentifierType) SEDAMetadata.fromSedaXml( + xmlReader, + InnerIdentifierType.class + ); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + archiveDeliveryRequestReply.requester.toString(), + null + ); } - SEDALibProgressLogger.doProgressLog(sedaLibProgressLogger, GLOBAL, - "sedalib: fin du bloc de fin spécifique du DIP", null); + SEDALibProgressLogger.doProgressLog( + sedaLibProgressLogger, + GLOBAL, + "sedalib: fin du bloc de fin spécifique du DIP", + null + ); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture de la fin du manifest", e); } @@ -257,15 +324,16 @@ private static void importFooter(SEDAXMLEventReader xmlReader, * completed * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importEndDocument(SEDAXMLEventReader xmlReader, - ArchiveDeliveryRequestReply archiveDeliveryRequestReply) throws SEDALibException { //NOSONAR + private static void importEndDocument( + SEDAXMLEventReader xmlReader, + ArchiveDeliveryRequestReply archiveDeliveryRequestReply + ) throws SEDALibException { //NOSONAR // this parameter may be useful in future if this function is improved XMLEvent event; try { xmlReader.endBlockNamed("ArchiveDeliveryRequestReply"); event = xmlReader.peekUsefullEvent(); - if (!event.isEndDocument()) - throw new SEDALibException("Pas de fin attendue du document XML"); + if (!event.isEndDocument()) throw new SEDALibException("Pas de fin attendue du document XML"); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture de la cloture du manifest", e); } @@ -282,19 +350,28 @@ private static void importEndDocument(SEDAXMLEventReader xmlReader, * @throws SEDALibException if the XML can't be read or is not in expected form * @throws InterruptedException if export process is interrupted */ - public static ArchiveDeliveryRequestReply fromSedaXml(SEDAXMLEventReader xmlReader, String rootDir, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static ArchiveDeliveryRequestReply fromSedaXml( + SEDAXMLEventReader xmlReader, + String rootDir, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { ArchiveDeliveryRequestReply archiveDeliveryRequestReply; importStartDocument(xmlReader); archiveDeliveryRequestReply = new ArchiveDeliveryRequestReply(); archiveDeliveryRequestReply.setGlobalMetadata(new GlobalMetadata()); importHeader(xmlReader, archiveDeliveryRequestReply, sedaLibProgressLogger); - archiveDeliveryRequestReply.setDataObjectPackage(DataObjectPackage.fromSedaXml(xmlReader, rootDir, sedaLibProgressLogger)); + archiveDeliveryRequestReply.setDataObjectPackage( + DataObjectPackage.fromSedaXml(xmlReader, rootDir, sedaLibProgressLogger) + ); importFooter(xmlReader, archiveDeliveryRequestReply, sedaLibProgressLogger); importEndDocument(xmlReader, archiveDeliveryRequestReply); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, - "sedalib: archiveDeliveryRequestReply importé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: archiveDeliveryRequestReply importé", + null + ); return archiveDeliveryRequestReply; } @@ -336,4 +413,4 @@ public DataObjectPackage getDataObjectPackage() { public void setDataObjectPackage(DataObjectPackage dataObjectPackage) { this.dataObjectPackage = dataObjectPackage; } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java index 0baf49a9..ae34ee85 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveTransfer.java @@ -124,23 +124,35 @@ private void exportStartDocument(SEDAXMLStreamWriter xmlWriter) throws SEDALibEx case V2_1: xmlWriter.writeDefaultNamespace("fr:gouv:culture:archivesdefrance:seda:v2.1"); xmlWriter.writeNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); - xmlWriter.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", - "fr:gouv:culture:archivesdefrance:seda:v2.1 seda-2.1-main.xsd"); + xmlWriter.writeAttribute( + "xsi", + "http://www.w3.org/2001/XMLSchema-instance", + "schemaLocation", + "fr:gouv:culture:archivesdefrance:seda:v2.1 seda-2.1-main.xsd" + ); break; case V2_2: xmlWriter.writeDefaultNamespace("fr:gouv:culture:archivesdefrance:seda:v2.2"); xmlWriter.writeNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); - xmlWriter.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", - "fr:gouv:culture:archivesdefrance:seda:v2.2 seda-2.2-main.xsd"); + xmlWriter.writeAttribute( + "xsi", + "http://www.w3.org/2001/XMLSchema-instance", + "schemaLocation", + "fr:gouv:culture:archivesdefrance:seda:v2.2 seda-2.2-main.xsd" + ); break; case V2_3: xmlWriter.writeDefaultNamespace("fr:gouv:culture:archivesdefrance:seda:v2.3"); xmlWriter.writeNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); - xmlWriter.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "schemaLocation", - "fr:gouv:culture:archivesdefrance:seda:v2.3 seda-2.3-main.xsd"); + xmlWriter.writeAttribute( + "xsi", + "http://www.w3.org/2001/XMLSchema-instance", + "schemaLocation", + "fr:gouv:culture:archivesdefrance:seda:v2.3 seda-2.3-main.xsd" + ); break; default: - throw new SEDALibException("Version ["+ SedaContext.getVersion() +"] sans schéma", null); + throw new SEDALibException("Version [" + SedaContext.getVersion() + "] sans schéma", null); } xmlWriter.setXmlId(true); } catch (XMLStreamException e) { @@ -158,8 +170,7 @@ private void exportStartDocument(SEDAXMLStreamWriter xmlWriter) throws SEDALibEx private void exportHeader(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeElementValueIfNotEmpty("Comment", globalMetadata.comment); - if (globalMetadata.isNowFlag()) - globalMetadata.date = SEDAXMLStreamWriter.getStringFromDateTime(null); + if (globalMetadata.isNowFlag()) globalMetadata.date = SEDAXMLStreamWriter.getStringFromDateTime(null); xmlWriter.writeElementValueIfNotEmpty("Date", globalMetadata.date); xmlWriter.writeElementValueIfNotEmpty("MessageIdentifier", globalMetadata.messageIdentifier); xmlWriter.writeElementValueIfNotEmpty("ArchivalAgreement", globalMetadata.archivalAgreement); @@ -178,15 +189,21 @@ private void exportHeader(SEDAXMLStreamWriter xmlWriter) throws SEDALibException private void exportFooter(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { - xmlWriter.writeElementValueIfNotEmpty("TransferRequestReplyIdentifier", - globalMetadata.transferRequestReplyIdentifier); + xmlWriter.writeElementValueIfNotEmpty( + "TransferRequestReplyIdentifier", + globalMetadata.transferRequestReplyIdentifier + ); xmlWriter.writeStartElement("ArchivalAgency"); xmlWriter.writeElementValue("Identifier", globalMetadata.archivalAgencyIdentifier); - xmlWriter.writeRawXMLBlockIfNotEmpty(globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData); + xmlWriter.writeRawXMLBlockIfNotEmpty( + globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData + ); xmlWriter.writeEndElement(); xmlWriter.writeStartElement("TransferringAgency"); xmlWriter.writeElementValue("Identifier", globalMetadata.transferringAgencyIdentifier); - xmlWriter.writeRawXMLBlockIfNotEmpty(globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData); + xmlWriter.writeRawXMLBlockIfNotEmpty( + globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData + ); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { throw new SEDALibException("Erreur d'écriture XML de la fin du manifest", e); @@ -220,8 +237,11 @@ private void exportEndDocument(SEDAXMLStreamWriter xmlWriter) throws SEDALibExce * @throws SEDALibException if the XML can't be written * @throws InterruptedException if export process is interrupted */ - public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException, InterruptedException { + public void toSedaXml( + SEDAXMLStreamWriter xmlWriter, + boolean imbricateFlag, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { exportStartDocument(xmlWriter); exportHeader(xmlWriter); dataObjectPackage.toSedaXml(xmlWriter, imbricateFlag, sedaLibProgressLogger); @@ -238,13 +258,11 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDA * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importStartDocument(SEDAXMLEventReader xmlReader) - throws SEDALibException { + private static void importStartDocument(SEDAXMLEventReader xmlReader) throws SEDALibException { XMLEvent event; try { event = xmlReader.nextUsefullEvent(); - if (!event.isStartDocument()) - throw new SEDALibException("Pas de document XML"); + if (!event.isStartDocument()) throw new SEDALibException("Pas de document XML"); if (!xmlReader.nextBlockIfNamed("ArchiveTransfer")) { throw new SEDALibException("Pas d'élément ArchiveTransfer"); } @@ -261,16 +279,19 @@ private static void importStartDocument(SEDAXMLEventReader xmlReader) * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importHeader(SEDAXMLEventReader xmlReader, ArchiveTransfer archiveTransfer) throws SEDALibException { + private static void importHeader(SEDAXMLEventReader xmlReader, ArchiveTransfer archiveTransfer) + throws SEDALibException { try { archiveTransfer.globalMetadata.comment = xmlReader.nextValueIfNamed("Comment"); archiveTransfer.globalMetadata.date = xmlReader.nextMandatoryValue("Date"); archiveTransfer.globalMetadata.messageIdentifier = xmlReader.nextMandatoryValue("MessageIdentifier"); - if (xmlReader.peekBlockIfNamed("Signature")) - throw new SEDALibException("L'élément Signature dans l'ArchiveTransfer n'est pas supporté"); + if (xmlReader.peekBlockIfNamed("Signature")) throw new SEDALibException( + "L'élément Signature dans l'ArchiveTransfer n'est pas supporté" + ); archiveTransfer.globalMetadata.archivalAgreement = xmlReader.nextValueIfNamed("ArchivalAgreement"); - archiveTransfer.globalMetadata - .codeListVersionsXmlData = xmlReader.nextMandatoryBlockAsString("CodeListVersions"); + archiveTransfer.globalMetadata.codeListVersionsXmlData = xmlReader.nextMandatoryBlockAsString( + "CodeListVersions" + ); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML d'entête du manifest", e); } @@ -284,25 +305,28 @@ private static void importHeader(SEDAXMLEventReader xmlReader, ArchiveTransfer a * @throws SEDALibException if the XML can't be read or is not in expected form */ private static void importFooter(SEDAXMLEventReader xmlReader, ArchiveTransfer archiveTransfer) - throws SEDALibException { + throws SEDALibException { try { - if (xmlReader.peekBlockIfNamed("RelatedTransferReference")) - throw new SEDALibException( - "L'élément RelatedTransferReference dans l'ArchiveTransfer n'est pas supporté"); - - archiveTransfer.globalMetadata - .transferRequestReplyIdentifier = xmlReader.nextValueIfNamed("TransferRequestReplyIdentifier"); - if (!xmlReader.nextBlockIfNamed("ArchivalAgency")) - throw new SEDALibException("Elément ArchivalAgency obligatoire"); + if (xmlReader.peekBlockIfNamed("RelatedTransferReference")) throw new SEDALibException( + "L'élément RelatedTransferReference dans l'ArchiveTransfer n'est pas supporté" + ); + + archiveTransfer.globalMetadata.transferRequestReplyIdentifier = xmlReader.nextValueIfNamed( + "TransferRequestReplyIdentifier" + ); + if (!xmlReader.nextBlockIfNamed("ArchivalAgency")) throw new SEDALibException( + "Elément ArchivalAgency obligatoire" + ); archiveTransfer.globalMetadata.archivalAgencyIdentifier = xmlReader.nextMandatoryValue("Identifier"); archiveTransfer.globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData = - xmlReader.nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); + xmlReader.nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); xmlReader.endBlockNamed("ArchivalAgency"); - if (!xmlReader.nextBlockIfNamed("TransferringAgency")) - throw new SEDALibException("Elément TransferingAgency Obligatoire"); + if (!xmlReader.nextBlockIfNamed("TransferringAgency")) throw new SEDALibException( + "Elément TransferingAgency Obligatoire" + ); archiveTransfer.globalMetadata.transferringAgencyIdentifier = xmlReader.nextMandatoryValue("Identifier"); archiveTransfer.globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData = - xmlReader.nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); + xmlReader.nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); xmlReader.endBlockNamed("TransferringAgency"); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture de la fin du manifest", e); @@ -315,14 +339,12 @@ private static void importFooter(SEDAXMLEventReader xmlReader, ArchiveTransfer a * @param xmlReader the SEDAXMLEventReader reading the SEDA manifest * @throws SEDALibException if the XML can't be read or is not in expected form */ - private static void importEndDocument(SEDAXMLEventReader xmlReader) - throws SEDALibException { + private static void importEndDocument(SEDAXMLEventReader xmlReader) throws SEDALibException { XMLEvent event; try { xmlReader.endBlockNamed("ArchiveTransfer"); event = xmlReader.peekUsefullEvent(); - if (!event.isEndDocument()) - throw new SEDALibException("Pas de fin attendue du document XML"); + if (!event.isEndDocument()) throw new SEDALibException("Pas de fin attendue du document XML"); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture de la cloture du manifest", e); } @@ -339,8 +361,11 @@ private static void importEndDocument(SEDAXMLEventReader xmlReader) * @throws SEDALibException if the XML can't be read or is not in expected form * @throws InterruptedException if export process is interrupted */ - public static ArchiveTransfer fromSedaXml(SEDAXMLEventReader xmlReader, String rootDir, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static ArchiveTransfer fromSedaXml( + SEDAXMLEventReader xmlReader, + String rootDir, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { ArchiveTransfer archiveTransfer; importStartDocument(xmlReader); archiveTransfer = new ArchiveTransfer(); @@ -350,18 +375,20 @@ public static ArchiveTransfer fromSedaXml(SEDAXMLEventReader xmlReader, String r importFooter(xmlReader, archiveTransfer); importEndDocument(xmlReader); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, - "sedalib: ArchiveTransfer importé", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: ArchiveTransfer importé", null); return archiveTransfer; } // SEDA Validator - public void sedaSchemaValidate(SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public void sedaSchemaValidate(SEDALibProgressLogger sedaLibProgressLogger) + throws SEDALibException, InterruptedException { String manifest; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT) + ) { toSedaXml(ixsw, true, sedaLibProgressLogger); manifest = baos.toString(StandardCharsets.UTF_8); } catch (XMLStreamException | IOException e) { @@ -372,10 +399,13 @@ public void sedaSchemaValidate(SEDALibProgressLogger sedaLibProgressLogger) thro sedaXMLvalidator.checkWithXSDSchema(manifest, sedaSchema); } - public void sedaProfileValidate(String profileFileName, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public void sedaProfileValidate(String profileFileName, SEDALibProgressLogger sedaLibProgressLogger) + throws SEDALibException, InterruptedException { String manifest; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT) + ) { toSedaXml(ixsw, true, sedaLibProgressLogger); manifest = baos.toString(StandardCharsets.UTF_8); } catch (XMLStreamException | IOException e) { @@ -383,15 +413,11 @@ public void sedaProfileValidate(String profileFileName, SEDALibProgressLogger se } SEDAXMLValidator sedaXMLvalidator = new SEDAXMLValidator(); Schema sedaSchema; - if (profileFileName.endsWith(".rng")) - sedaSchema = sedaXMLvalidator.getSchemaFromRNGFile(profileFileName); - else - sedaSchema = sedaXMLvalidator.getSchemaFromXSDFile(profileFileName); - - if (profileFileName.endsWith(".rng")) - sedaXMLvalidator.checkWithRNGSchema(manifest, sedaSchema); - else - sedaXMLvalidator.checkWithXSDSchema(manifest, sedaSchema); + if (profileFileName.endsWith(".rng")) sedaSchema = sedaXMLvalidator.getSchemaFromRNGFile(profileFileName); + else sedaSchema = sedaXMLvalidator.getSchemaFromXSDFile(profileFileName); + + if (profileFileName.endsWith(".rng")) sedaXMLvalidator.checkWithRNGSchema(manifest, sedaSchema); + else sedaXMLvalidator.checkWithXSDSchema(manifest, sedaSchema); } // Getters and setters @@ -431,4 +457,4 @@ public DataObjectPackage getDataObjectPackage() { public void setDataObjectPackage(DataObjectPackage dataObjectPackage) { this.dataObjectPackage = dataObjectPackage; } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java index 6c77166f..b03aee2c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnit.java @@ -146,12 +146,11 @@ public ArchiveUnit(DataObjectPackage dataObjectPackage) { this.content = null; this.childrenAuList = new ArchiveUnitRefList(dataObjectPackage); this.dataObjectRefList = new DataObjectRefList(dataObjectPackage); - if (dataObjectPackage != null) - try { - dataObjectPackage.addArchiveUnit(this); - } catch (SEDALibException forget) { - // impossible as the uniqID is generated by the called function. - } + if (dataObjectPackage != null) try { + dataObjectPackage.addArchiveUnit(this); + } catch (SEDALibException forget) { + // impossible as the uniqID is generated by the called function. + } } // Getters and setters @@ -162,10 +161,8 @@ public ArchiveUnit(DataObjectPackage dataObjectPackage) { * @return the archive unit profile xml data */ public String getArchiveUnitProfileXmlData() { - if (archiveUnitProfileXmlData != null) - return archiveUnitProfileXmlData; - if (archiveUnitProfile == null) - return null; + if (archiveUnitProfileXmlData != null) return archiveUnitProfileXmlData; + if (archiveUnitProfile == null) return null; archiveUnitProfileXmlData = archiveUnitProfile.toString(); return archiveUnitProfileXmlData; } @@ -191,10 +188,11 @@ public ArchiveUnitProfile getArchiveUnitProfile() throws SEDALibException { archiveUnitProfileXmlData = null; return archiveUnitProfile; } - if (archiveUnitProfileXmlData == null) - return null; - archiveUnitProfile = (ArchiveUnitProfile) SEDAMetadata.fromString(archiveUnitProfileXmlData, - ArchiveUnitProfile.class); + if (archiveUnitProfileXmlData == null) return null; + archiveUnitProfile = (ArchiveUnitProfile) SEDAMetadata.fromString( + archiveUnitProfileXmlData, + ArchiveUnitProfile.class + ); // as fromString function normalise ArchiveUnitProfile had to destroy approximate version archiveUnitProfileXmlData archiveUnitProfileXmlData = null; return archiveUnitProfile; @@ -216,10 +214,8 @@ public void setArchiveUnitProfile(ArchiveUnitProfile archiveUnitProfile) { * @return the management xml data */ public String getManagementXmlData() { - if (managementXmlData != null) - return managementXmlData; - if (management == null) - return null; + if (managementXmlData != null) return managementXmlData; + if (management == null) return null; managementXmlData = management.toString(); return managementXmlData; } @@ -245,10 +241,8 @@ public Management getManagement() throws SEDALibException { managementXmlData = null; return management; } - if (managementXmlData == null) - return null; - management = (Management) SEDAMetadata.fromString(managementXmlData, - Management.class); + if (managementXmlData == null) return null; + management = (Management) SEDAMetadata.fromString(managementXmlData, Management.class); // as fromString function normalise Management had to destroy approximate version managementXmlData managementXmlData = null; return management; @@ -270,10 +264,8 @@ public void setManagement(Management management) { * @return the content xml data */ public String getContentXmlData() { - if (contentXmlData != null) - return contentXmlData; - if (content == null) - return null; + if (contentXmlData != null) return contentXmlData; + if (content == null) return null; contentXmlData = content.toString(); return contentXmlData; } @@ -285,13 +277,10 @@ public String getContentXmlData() { */ @JsonIgnore public boolean isContentSEDACompliant() { - if (content != null) - return true; - if (contentXmlData == null) - return false; + if (content != null) return true; + if (contentXmlData == null) return false; try { - content = (Content) SEDAMetadata.fromString(contentXmlData, - Content.class); + content = (Content) SEDAMetadata.fromString(contentXmlData, Content.class); contentXmlData = null; } catch (SEDALibException e) { return false; @@ -306,13 +295,10 @@ public boolean isContentSEDACompliant() { */ @JsonIgnore public String getFilteredContentExportString() { - if (getDataObjectPackage().getExportMetadataList() == null) - return getContentXmlData(); - if (content != null) - return content.filteredToString(getDataObjectPackage().getExportMetadataList()); + if (getDataObjectPackage().getExportMetadataList() == null) return getContentXmlData(); + if (content != null) return content.filteredToString(getDataObjectPackage().getExportMetadataList()); try { - content = (Content) SEDAMetadata.fromString(contentXmlData, - Content.class); + content = (Content) SEDAMetadata.fromString(contentXmlData, Content.class); contentXmlData = null; } catch (SEDALibException e) { return contentXmlData; @@ -341,10 +327,8 @@ public Content getContent() throws SEDALibException { contentXmlData = null; return content; } - if (contentXmlData == null) - return null; - content = (Content) SEDAMetadata.fromString(contentXmlData, - Content.class); + if (contentXmlData == null) return null; + content = (Content) SEDAMetadata.fromString(contentXmlData, Content.class); // as fromString function normalise Content had to destroy approximate version contentXmlData contentXmlData = null; return content; @@ -369,7 +353,7 @@ public void setContent(Content content) { * @param descriptionLevel the ArchiveUnit description level * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public void setDefaultContent(String title, String descriptionLevel) throws SEDALibException{ + public void setDefaultContent(String title, String descriptionLevel) throws SEDALibException { Content c = new Content(); c.addNewMetadata("DescriptionLevel", descriptionLevel); c.addNewMetadata("Title", title); @@ -419,7 +403,7 @@ public void removeChildArchiveUnit(ArchiveUnit au) { * @param newAu the new ArchiveUnit */ public void replaceChildArchiveUnit(ArchiveUnit originAu, ArchiveUnit newAu) { - childrenAuList.replace(originAu,newAu); + childrenAuList.replace(originAu, newAu); } /** @@ -453,8 +437,11 @@ public void removeChildArchiveUnitById(String inDataPackageObjectId) { * @throws SEDALibException if the XML can't be written * @throws InterruptedException if export process is interrupted */ - public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException, InterruptedException { + public void toSedaXml( + SEDAXMLStreamWriter xmlWriter, + boolean imbricateFlag, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { try { if (imbricateFlag) { if (getDataObjectPackage().isTouchedInDataObjectPackageId(inDataPackageObjectId)) { @@ -463,22 +450,25 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDA xmlWriter.writeElementValue("ArchiveUnitRefId", inDataPackageObjectId); xmlWriter.writeEndElement(); return; - } else - getDataObjectPackage().addTouchedInDataObjectPackageId(inDataPackageObjectId); + } else getDataObjectPackage().addTouchedInDataObjectPackageId(inDataPackageObjectId); } xmlWriter.writeStartElement("ArchiveUnit"); xmlWriter.writeAttribute("id", inDataPackageObjectId); xmlWriter.writeRawXMLBlockIfNotEmpty(getArchiveUnitProfileXmlData()); xmlWriter.writeRawXMLBlockIfNotEmpty(getManagementXmlData()); - if ((getDataObjectPackage().getExportMetadataList() != null) && - !isContentSEDACompliant()) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, - "sedalib: l'ArchiveUnit [" + inDataPackageObjectId + "] ne peut être filtrée car son Content " + - "n'est pas conforme SEDA. Le Content est écrit tel quel.", null); + if ((getDataObjectPackage().getExportMetadataList() != null) && !isContentSEDACompliant()) { + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: l'ArchiveUnit [" + + inDataPackageObjectId + + "] ne peut être filtrée car son Content " + + "n'est pas conforme SEDA. Le Content est écrit tel quel.", + null + ); xmlWriter.writeRawXMLBlockIfNotEmpty(getContentXmlData()); - } else - xmlWriter.writeRawXMLBlockIfNotEmpty(getFilteredContentExportString()); + } else xmlWriter.writeRawXMLBlockIfNotEmpty(getFilteredContentExportString()); for (ArchiveUnit au : childrenAuList.getArchiveUnitList()) { if (!imbricateFlag) { xmlWriter.writeStartElement("ArchiveUnit"); @@ -491,21 +481,25 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDA } for (DataObject dataObject : dataObjectRefList.getDataObjectList()) { xmlWriter.writeStartElement("DataObjectReference"); - if (dataObject instanceof DataObjectGroup) - xmlWriter.writeElementValue("DataObjectGroupReferenceId", dataObject.getInDataObjectPackageId()); - else - xmlWriter.writeElementValue("DataObjectReferenceId", dataObject.getInDataObjectPackageId()); + if (dataObject instanceof DataObjectGroup) xmlWriter.writeElementValue( + "DataObjectGroupReferenceId", + dataObject.getInDataObjectPackageId() + ); + else xmlWriter.writeElementValue("DataObjectReferenceId", dataObject.getInDataObjectPackageId()); xmlWriter.writeEndElement(); } xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException( - "Erreur d'écriture XML de l'ArchiveUnit [" + inDataPackageObjectId + "]", e); + throw new SEDALibException("Erreur d'écriture XML de l'ArchiveUnit [" + inDataPackageObjectId + "]", e); } int counter = getDataObjectPackage().getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " métadonnées ArchiveUnit exportées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " métadonnées ArchiveUnit exportées" + ); } /** @@ -518,14 +512,11 @@ public String toSedaXmlFragments() { StringBuilder sb = new StringBuilder(); String tmp = getArchiveUnitProfileXmlData(); - if (tmp != null) - sb.append(tmp).append("\n"); + if (tmp != null) sb.append(tmp).append("\n"); tmp = getManagementXmlData(); - if (tmp != null) - sb.append(tmp).append("\n"); + if (tmp != null) sb.append(tmp).append("\n"); tmp = getContentXmlData(); - if (tmp != null) - sb.append(tmp).append("\n"); + if (tmp != null) sb.append(tmp).append("\n"); return sb.toString().trim(); } @@ -542,8 +533,11 @@ public String toSedaXmlFragments() { * @throws SEDALibException if the XML can't be read * @throws InterruptedException if export process is interrupted */ - public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static String idFromSedaXml( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { ArchiveUnit au = null; DataObject dataObject; String tmp; @@ -555,7 +549,6 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka tmp = xmlReader.nextMandatoryValue("ArchiveUnitRefId"); xmlReader.endBlockNamed("ArchiveUnit"); return tmp; - } else { au = new ArchiveUnit(); au.inDataPackageObjectId = tmp; @@ -565,8 +558,7 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka au.setContentXmlData(xmlReader.nextBlockAsStringIfNamed("Content")); while (true) { tmp = xmlReader.peekName(); - if (tmp == null) - break; + if (tmp == null) break; switch (tmp) { case "ArchiveUnit": String subAuId = idFromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); @@ -575,50 +567,60 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka case "DataObjectReference": xmlReader.nextUsefullEvent(); tmp = xmlReader.peekName(); - if (tmp == null) - break; + if (tmp == null) break; switch (tmp) { case "DataObjectReferenceId": tmp = xmlReader.nextValueIfNamed("DataObjectReferenceId"); dataObject = dataObjectPackage.getDataObjectById(tmp); - if ((dataObject == null) || (dataObject instanceof DataObjectGroup)) - throw new SEDALibException( - "Erreur de référence DataObjectReferenceId [" + tmp + "]"); + if ( + (dataObject == null) || (dataObject instanceof DataObjectGroup) + ) throw new SEDALibException( + "Erreur de référence DataObjectReferenceId [" + tmp + "]" + ); au.addDataObjectById(tmp); break; case "DataObjectGroupReferenceId": tmp = xmlReader.nextValueIfNamed("DataObjectGroupReferenceId"); dataObject = dataObjectPackage.getDataObjectById(tmp); - if (!(dataObject instanceof DataObjectGroup)) - throw new SEDALibException( - "Erreur de référence DataObjectGroupReferenceId [" + tmp + "]"); + if (!(dataObject instanceof DataObjectGroup)) throw new SEDALibException( + "Erreur de référence DataObjectGroupReferenceId [" + tmp + "]" + ); au.addDataObjectById(tmp); break; default: throw new SEDALibException("Element DataObjectReference mal formé"); - } xmlReader.endBlockNamed("DataObjectReference"); break; default: - throw new SEDALibException("Element ArchiveUnit [" + au.inDataPackageObjectId - + "] mal formé, élément [" + tmp + "] anormal"); - + throw new SEDALibException( + "Element ArchiveUnit [" + + au.inDataPackageObjectId + + "] mal formé, élément [" + + tmp + + "] anormal" + ); } } xmlReader.endBlockNamed("ArchiveUnit"); } } } catch (XMLStreamException e) { - throw new SEDALibException("Erreur de lecture XML de l'ArchiveUnit" - + (au != null ? " [" + au.inDataPackageObjectId + "]" : ""), e); + throw new SEDALibException( + "Erreur de lecture XML de l'ArchiveUnit" + (au != null ? " [" + au.inDataPackageObjectId + "]" : ""), + e + ); } // next XML element not an ArchiveUnit - if (au == null) - return null; + if (au == null) return null; int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, "sedalib: " + counter + " métadonnées ArchiveUnit importées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " métadonnées ArchiveUnit importées" + ); return au.inDataPackageObjectId; } @@ -633,23 +635,24 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka public void fromSedaXmlFragments(String fragments) throws SEDALibException { ArchiveUnit au = new ArchiveUnit(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); au.setArchiveUnitProfileXmlData(xmlReader.nextBlockAsStringIfNamed("ArchiveUnitProfile")); au.setManagementXmlData(xmlReader.nextBlockAsStringIfNamed("Management")); au.setContentXmlData(xmlReader.nextBlockAsStringIfNamed("Content")); XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new SEDALibException("Il y a des champs illégaux"); + if (!event.isEndDocument()) throw new SEDALibException("Il y a des champs illégaux"); } catch (XMLStreamException | SEDALibException | IOException e) { - throw new SEDALibException( - "Erreur de lecture XML de l'ArchiveUnit [" + inDataPackageObjectId + "]", e); + throw new SEDALibException("Erreur de lecture XML de l'ArchiveUnit [" + inDataPackageObjectId + "]", e); } - if (au.getContentXmlData() == null) - throw new SEDALibException("La partie de l'ArchiveUnit est obligatoire"); + if (au.getContentXmlData() == null) throw new SEDALibException( + "La partie de l'ArchiveUnit est obligatoire" + ); setArchiveUnitProfileXmlData(au.getArchiveUnitProfileXmlData()); setManagementXmlData(au.getManagementXmlData()); setContentXmlData(au.getContentXmlData()); @@ -662,18 +665,18 @@ public void fromSedaXmlFragments(String fragments) throws SEDALibException { */ public String toString() { String result = null; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2) + ) { toSedaXml(xmlWriter, true, null); xmlWriter.flush(); result = baos.toString(StandardCharsets.UTF_8); - if (result.startsWith("\n")) - result = result.substring(1); + if (result.startsWith("\n")) result = result.substring(1); } catch (XMLStreamException | IOException | SEDALibException e) { - result = super.toString(); - } - catch (InterruptedException e){ - result = super.toString(); + result = super.toString(); + } catch (InterruptedException e) { + result = super.toString(); Thread.currentThread().interrupt(); } return result; @@ -724,11 +727,9 @@ public void setDataObjectRefList(DataObjectRefList dataObjectRefList) { */ @JsonIgnore public DataObjectGroup getTheDataObjectGroup() { - if (dataObjectRefList.getCount() != 1) - return null; + if (dataObjectRefList.getCount() != 1) return null; DataObject tmp = dataObjectRefList.getDataObjectList().get(0); - if (tmp instanceof DataObjectGroup) - return (DataObjectGroup) tmp; + if (tmp instanceof DataObjectGroup) return (DataObjectGroup) tmp; return null; } @@ -736,8 +737,7 @@ private ArchiveUnit searchDOGArchiveUnit(DataObjectGroup dataObjectGroup) { DataObjectGroup dog; for (Map.Entry e : getDataObjectPackage().getAuInDataObjectPackageIdMap().entrySet()) { dog = e.getValue().getTheDataObjectGroup(); - if ((dog != null) && (dog.equals(dataObjectGroup))) - return e.getValue(); + if ((dog != null) && (dog.equals(dataObjectGroup))) return e.getValue(); } return null; } @@ -750,11 +750,11 @@ private ArchiveUnit searchDOGArchiveUnit(DataObjectGroup dataObjectGroup) { public boolean removeEmptyDataObjectGroup() { DataObjectGroup dog = getTheDataObjectGroup(); if (dog != null) { - if (dog.getPhysicalDataObjectList().size()+dog.getBinaryDataObjectList().size()!=0) - return false; + if (dog.getPhysicalDataObjectList().size() + dog.getBinaryDataObjectList().size() != 0) return false; removeDataObjectById(dog.getInDataObjectPackageId()); - if (searchDOGArchiveUnit(dog) == null) - getDataObjectPackage().getDogInDataObjectPackageIdMap().remove(dog.getInDataObjectPackageId()); + if (searchDOGArchiveUnit(dog) == null) getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .remove(dog.getInDataObjectPackageId()); } return true; } @@ -772,5 +772,4 @@ public void setDataObjectPackage(DataObjectPackage dataObjectPackage) { childrenAuList.setDataObjectPackage(dataObjectPackage); dataObjectRefList.setDataObjectPackage(dataObjectPackage); } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java index 22ab3452..6185fc78 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/ArchiveUnitRefList.java @@ -70,8 +70,7 @@ public class ArchiveUnitRefList extends DataObjectPackageElement { /** * Instantiates a new ArchiveUnit references list. */ - public ArchiveUnitRefList() { - } + public ArchiveUnitRefList() {} /** * Instantiates a new ArchiveUnit references list. @@ -90,14 +89,11 @@ public ArchiveUnitRefList(DataObjectPackage dataObjectPackage) { * @return the inDataPackageObjectId list */ public List getInDataObjectPackageIdList() { - if (inDataObjectPackageIdList != null) - return inDataObjectPackageIdList; - if (archiveUnitList == null) - inDataObjectPackageIdList = new ArrayList<>(0); + if (inDataObjectPackageIdList != null) return inDataObjectPackageIdList; + if (archiveUnitList == null) inDataObjectPackageIdList = new ArrayList<>(0); else { inDataObjectPackageIdList = new ArrayList<>(archiveUnitList.size()); - for (ArchiveUnit au : archiveUnitList) - inDataObjectPackageIdList.add(au.inDataPackageObjectId); + for (ArchiveUnit au : archiveUnitList) inDataObjectPackageIdList.add(au.inDataPackageObjectId); } archiveUnitList = null; return inDataObjectPackageIdList; @@ -120,14 +116,13 @@ public void setInDataObjectPackageIdList(List inDataObjectPackageIdList) */ @JsonIgnore public List getArchiveUnitList() { - if (archiveUnitList != null) - return archiveUnitList; - if (inDataObjectPackageIdList == null) - archiveUnitList = new ArrayList<>(0); + if (archiveUnitList != null) return archiveUnitList; + if (inDataObjectPackageIdList == null) archiveUnitList = new ArrayList<>(0); else { archiveUnitList = new ArrayList<>(inDataObjectPackageIdList.size()); - for (String inSipId : inDataObjectPackageIdList) - archiveUnitList.add(getDataObjectPackage().getArchiveUnitById(inSipId)); + for (String inSipId : inDataObjectPackageIdList) archiveUnitList.add( + getDataObjectPackage().getArchiveUnitById(inSipId) + ); } inDataObjectPackageIdList = null; return archiveUnitList; @@ -178,9 +173,9 @@ public void remove(ArchiveUnit archiveUnit) { * @param newArchiveUnit the new ArchiveUnit */ public void replace(ArchiveUnit originArchiveUnit, ArchiveUnit newArchiveUnit) { - List listAu=getArchiveUnitList(); - for (int i=0;i listAu = getArchiveUnitList(); + for (int i = 0; i < listAu.size(); i++) { + if (listAu.get(i) == originArchiveUnit) { listAu.set(i, newArchiveUnit); return; } @@ -203,10 +198,8 @@ public void removeById(String inDataObjectPackageId) { */ @JsonIgnore public int getCount() { - if (inDataObjectPackageIdList != null) - return inDataObjectPackageIdList.size(); - else if (archiveUnitList != null) - return archiveUnitList.size(); + if (inDataObjectPackageIdList != null) return inDataObjectPackageIdList.size(); + else if (archiveUnitList != null) return archiveUnitList.size(); return 0; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java index e2006b4e..87347a69 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObject.java @@ -70,6 +70,7 @@ public class BinaryDataObject extends AbstractUnitaryDataObject implements DataObject, ComplexListInterface { private static class MetadataField { + final String key; final ComplexListMetadataKind kind; final Set versions; @@ -86,25 +87,31 @@ boolean isForVersion(int version) { } private static final List ALL_FIELDS = Arrays.asList( - new MetadataField("DataObjectProfile", new ComplexListMetadataKind(StringType.class, false), 2, 3), - new MetadataField("DataObjectSystemId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("DataObjectGroupSystemId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("Relationship", new ComplexListMetadataKind(Relationship.class, true), 1, 2, 3), - new MetadataField("DataObjectGroupReferenceId", new ComplexListMetadataKind(StringType.class, false), 1), - new MetadataField("DataObjectGroupId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("DataObjectVersion", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("PersistentIdentifier", new ComplexListMetadataKind(PersistentIdentifier.class, true), 3), - new MetadataField("DataObjectUse", new ComplexListMetadataKind(StringType.class, false), 3), - new MetadataField("DataObjectNumber", new ComplexListMetadataKind(IntegerType.class, false), 3), - new MetadataField("Uri", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("MessageDigest", new ComplexListMetadataKind(DigestType.class, false), 1, 2, 3), - new MetadataField("Size", new ComplexListMetadataKind(IntegerType.class, false), 1, 2, 3), - new MetadataField("Compressed", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), - new MetadataField("FormatIdentification", new ComplexListMetadataKind(FormatIdentification.class, false), 1, - 2, 3), - new MetadataField("FileInfo", new ComplexListMetadataKind(FileInfo.class, false), 1, 2, 3), - new MetadataField("Metadata", new ComplexListMetadataKind(Metadata.class, false), 1, 2, 3), - new MetadataField("OtherMetadata", new ComplexListMetadataKind(AnyXMLListType.class, false), 1, 2, 3)); + new MetadataField("DataObjectProfile", new ComplexListMetadataKind(StringType.class, false), 2, 3), + new MetadataField("DataObjectSystemId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField("DataObjectGroupSystemId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField("Relationship", new ComplexListMetadataKind(Relationship.class, true), 1, 2, 3), + new MetadataField("DataObjectGroupReferenceId", new ComplexListMetadataKind(StringType.class, false), 1), + new MetadataField("DataObjectGroupId", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField("DataObjectVersion", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField("PersistentIdentifier", new ComplexListMetadataKind(PersistentIdentifier.class, true), 3), + new MetadataField("DataObjectUse", new ComplexListMetadataKind(StringType.class, false), 3), + new MetadataField("DataObjectNumber", new ComplexListMetadataKind(IntegerType.class, false), 3), + new MetadataField("Uri", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField("MessageDigest", new ComplexListMetadataKind(DigestType.class, false), 1, 2, 3), + new MetadataField("Size", new ComplexListMetadataKind(IntegerType.class, false), 1, 2, 3), + new MetadataField("Compressed", new ComplexListMetadataKind(StringType.class, false), 1, 2, 3), + new MetadataField( + "FormatIdentification", + new ComplexListMetadataKind(FormatIdentification.class, false), + 1, + 2, + 3 + ), + new MetadataField("FileInfo", new ComplexListMetadataKind(FileInfo.class, false), 1, 2, 3), + new MetadataField("Metadata", new ComplexListMetadataKind(Metadata.class, false), 1, 2, 3), + new MetadataField("OtherMetadata", new ComplexListMetadataKind(AnyXMLListType.class, false), 1, 2, 3) + ); private static LinkedHashMap createMetadataMapForVersion(int version) { LinkedHashMap map = new LinkedHashMap<>(); @@ -131,8 +138,7 @@ private static LinkedHashMap createMetadataMapF @JsonIgnore @Override public LinkedHashMap getMetadataMap() throws SEDALibException { - return (LinkedHashMap) ComplexListInterface - .getMetadataMap(this.getClass()); + return (LinkedHashMap) ComplexListInterface.getMetadataMap(this.getClass()); } /** @@ -141,8 +147,7 @@ public LinkedHashMap getMetadataMap() throws SE @JsonIgnore @Override public boolean isNotExpandable() { - return ComplexListInterface - .isNotExpandable(this.getClass()); + return ComplexListInterface.isNotExpandable(this.getClass()); } // Inner element @@ -182,16 +187,15 @@ public BinaryDataObject(DataObjectPackage dataObjectPackage) { */ private void addFilenameMetadata(Path path, String explicitFilename) { String nameValue = explicitFilename != null - ? explicitFilename - : (path != null ? path.getFileName().toString() : null); + ? explicitFilename + : (path != null ? path.getFileName().toString() : null); if (nameValue == null) { return; } FileInfo fileInfo = new FileInfo(); try { fileInfo.addNewMetadata("Filename", nameValue); - } catch (SEDALibException ignored) { - } + } catch (SEDALibException ignored) {} metadataList.add(fileInfo); } @@ -208,11 +212,14 @@ private void addFilenameMetadata(Path path, String explicitFilename) { * @param explicitFilename the filename metadata * @param dataObjectVersion the DataObjectVersion */ - public BinaryDataObject(DataObjectPackage dataObjectPackage, Path path, String explicitFilename, - String dataObjectVersion) { + public BinaryDataObject( + DataObjectPackage dataObjectPackage, + Path path, + String explicitFilename, + String dataObjectVersion + ) { super(dataObjectPackage); - if (dataObjectVersion != null) - metadataList.add(new StringType("DataObjectVersion", dataObjectVersion)); + if (dataObjectVersion != null) metadataList.add(new StringType("DataObjectVersion", dataObjectVersion)); addFilenameMetadata(path, explicitFilename); this.onDiskPath = (path != null ? path.toAbsolutePath().normalize() : null); } @@ -263,8 +270,7 @@ public BinaryDataObject(DataObjectPackage dataObjectPackage, String xmlData) thr * @return the extension */ private static String getExtension(String fileName) { - if (fileName == null) - return ""; + if (fileName == null) return ""; int i = fileName.lastIndexOf('.'); return i < 0 ? "seda" : fileName.substring(i + 1); } @@ -285,8 +291,7 @@ private void updateFileInfo(FileTime lastModifiedTime) throws SEDALibException { if (fileInfo == null) { fileInfo = new FileInfo(); filename = null; - } else - filename = fileInfo.getSimpleMetadata("Filename"); + } else filename = fileInfo.getSimpleMetadata("Filename"); if (filename == null) { filename = onDiskPath.getFileName().toString(); @@ -309,10 +314,11 @@ private IdentificationResult identifyFormat(SEDALibProgressLogger logger, Path p return DroidIdentifier.getInstance().getIdentificationResult(path); } catch (SEDALibException e) { doProgressLogWithoutInterruption( - logger, - OBJECTS_WARNINGS, - "sedalib: impossible de faire l'identification Droid pour le fichier [" + path + "]", - e); + logger, + OBJECTS_WARNINGS, + "sedalib: impossible de faire l'identification Droid pour le fichier [" + path + "]", + e + ); return null; } } @@ -333,19 +339,23 @@ public void extractTechnicalElements(SEDALibProgressLogger sedaLibProgressLogger size = Files.size(onDiskPath); lastModifiedTime = Files.getLastModifiedTime(onDiskPath); } catch (IOException e) { - throw new SEDALibException("Impossible d'obtenir les infos techniques pour le fichier [" - + onDiskPath.toString() + "]", e); + throw new SEDALibException( + "Impossible d'obtenir les infos techniques pour le fichier [" + onDiskPath.toString() + "]", + e + ); } updateFileInfo(lastModifiedTime); - addMetadata(new DigestType("MessageDigest", DigestSha512.compute(onDiskPath, sedaLibProgressLogger), "SHA-512")); + addMetadata( + new DigestType("MessageDigest", DigestSha512.compute(onDiskPath, sedaLibProgressLogger), "SHA-512") + ); addMetadata(new IntegerType("Size", size)); IdentificationResult idResult = identifyFormat(sedaLibProgressLogger, onDiskPath); - if (idResult != null) - addMetadata(new FormatIdentification(idResult.getName(), idResult.getMimeType(), idResult.getPuid(), null)); - else - addMetadata(new FormatIdentification("Unknown", null, "UNKNOWN", null)); + if (idResult != null) addMetadata( + new FormatIdentification(idResult.getName(), idResult.getMimeType(), idResult.getPuid(), null) + ); + else addMetadata(new FormatIdentification("Unknown", null, "UNKNOWN", null)); } /** @@ -378,7 +388,7 @@ private void finalizeUri() throws SEDALibException { * sedalib.xml.SEDAXMLStreamWriter) */ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaLibProgressLogger) - throws InterruptedException, SEDALibException { + throws InterruptedException, SEDALibException { finalizeUri(); super.toSedaXml(xmlWriter, sedaLibProgressLogger); } @@ -398,13 +408,17 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaL * not respected * @throws InterruptedException if export process is interrupted */ - public static BinaryDataObject fromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static BinaryDataObject fromSedaXml( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { BinaryDataObject bdo = new BinaryDataObject(); - return (importUnitaryDataObjectPackageIdElementFromSedaXml(bdo, xmlReader, dataObjectPackage, - sedaLibProgressLogger) - ? bdo - : null); + return ( + importUnitaryDataObjectPackageIdElementFromSedaXml(bdo, xmlReader, dataObjectPackage, sedaLibProgressLogger) + ? bdo + : null + ); } /** diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java index 15faa757..63053abc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObject.java @@ -49,7 +49,6 @@ * edition, and linked to ArchiveUnit. */ public interface DataObject { - // SEDA XML exporter /** @@ -61,7 +60,7 @@ public interface DataObject { * @throws SEDALibException if the XML can't be written */ void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaLibProgressLogger) - throws InterruptedException, SEDALibException; + throws InterruptedException, SEDALibException; /** * Export the elements that can be edited without changing the structure. This diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java index 520e2ea7..ee850f2f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectGroup.java @@ -104,16 +104,13 @@ public DataObjectGroup(DataObjectPackage dataObjectPackage, Path path) { this.binaryDataObjectList = new ArrayList<>(); this.physicalDataObjectList = new ArrayList<>(); this.logBook = null; - if (path == null) - this.onDiskPath = null; - else - this.onDiskPath = path.toAbsolutePath().normalize(); - if (dataObjectPackage != null) - try { - dataObjectPackage.addDataObjectGroup(this); - } catch (SEDALibException ignored) { - // impossible as the uniqID is generated by the called function. - } + if (path == null) this.onDiskPath = null; + else this.onDiskPath = path.toAbsolutePath().normalize(); + if (dataObjectPackage != null) try { + dataObjectPackage.addDataObjectGroup(this); + } catch (SEDALibException ignored) { + // impossible as the uniqID is generated by the called function. + } } // Methods @@ -160,13 +157,15 @@ public boolean removeDataObject(DataObject zdo) { public DataObject findDataObjectByDataObjectVersion(String dataObjectVersion) { for (BinaryDataObject bdo : binaryDataObjectList) { StringType bdoDataObjectVersion = bdo.getMetadataDataObjectVersion(); - if ((bdoDataObjectVersion != null) && (bdoDataObjectVersion.getValue().equals(dataObjectVersion))) - return bdo; + if ( + (bdoDataObjectVersion != null) && (bdoDataObjectVersion.getValue().equals(dataObjectVersion)) + ) return bdo; } for (PhysicalDataObject pdo : physicalDataObjectList) { StringType pdoDataObjectVersion = pdo.getMetadataDataObjectVersion(); - if ((pdoDataObjectVersion != null) && (pdoDataObjectVersion.getValue().equals(dataObjectVersion))) - return pdo; + if ( + (pdoDataObjectVersion != null) && (pdoDataObjectVersion.getValue().equals(dataObjectVersion)) + ) return pdo; } return null; } @@ -187,11 +186,13 @@ public void mergeDataObjectGroup(DataObjectGroup dataObjectGroup) throws SEDALib addDataObject(pdo); } // merge logbooks - if (logBook == null) - logBook = dataObjectGroup.logBook; + if (logBook == null) logBook = dataObjectGroup.logBook; else if (dataObjectGroup.logBook != null) { - logBook = (LogBook) SEDAMetadata.fromString(logBook.toString().replace("", "") + - dataObjectGroup.logBook.toString().replace("", ""), LogBook.class); + logBook = (LogBook) SEDAMetadata.fromString( + logBook.toString().replace("", "") + + dataObjectGroup.logBook.toString().replace("", ""), + LogBook.class + ); } } @@ -205,7 +206,7 @@ else if (dataObjectGroup.logBook != null) { * sedalib.xml.SEDAXMLStreamWriter) */ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException, InterruptedException { + throws SEDALibException, InterruptedException { try { xmlWriter.writeStartElement("DataObjectGroup"); xmlWriter.writeAttribute("id", inDataPackageObjectId); @@ -218,8 +219,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaL if (logBook != null) logBook.toSedaXml(xmlWriter); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException( - "Erreur d'écriture XML du DataObjectGroup [" + inDataPackageObjectId + "]", e); + throw new SEDALibException("Erreur d'écriture XML du DataObjectGroup [" + inDataPackageObjectId + "]", e); } } @@ -230,8 +230,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaL */ @Override public String toSedaXmlFragments() { - if (logBook == null) - return ""; + if (logBook == null) return ""; return logBook.toString(); } @@ -251,8 +250,12 @@ public String toSedaXmlFragments() { * not respected * @throws InterruptedException if export process is interrupted */ - public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - String rootDir, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static String idFromSedaXml( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + String rootDir, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { DataObjectGroup dog = null; BinaryDataObject bdo; PhysicalDataObject pdo; @@ -268,29 +271,44 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka loop = true; while (loop) { tmp = xmlReader.peekName(); - if (tmp == null) - break; + if (tmp == null) break; switch (tmp) { case "BinaryDataObject": bdo = BinaryDataObject.fromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); - StringType bdoDataObjectGroupId = (StringType) bdo.getFirstNamedMetadata("DataObjectGroupId"); - StringType bdoDataObjectGroupReferenceId = (StringType) bdo.getFirstNamedMetadata("DataObjectGroupReferenceId"); - if ((bdoDataObjectGroupId != null) || (bdoDataObjectGroupReferenceId != null)) - throw new SEDALibException("Le BinaryDataObject [" + bdo.inDataPackageObjectId - + "] utilise un raccordement DataObjectGroup mode SEDA2.0 " - + "dans un DataObjectGroup mode " + SedaContext.getVersion()); + StringType bdoDataObjectGroupId = (StringType) bdo.getFirstNamedMetadata( + "DataObjectGroupId" + ); + StringType bdoDataObjectGroupReferenceId = (StringType) bdo.getFirstNamedMetadata( + "DataObjectGroupReferenceId" + ); + if ( + (bdoDataObjectGroupId != null) || (bdoDataObjectGroupReferenceId != null) + ) throw new SEDALibException( + "Le BinaryDataObject [" + + bdo.inDataPackageObjectId + + "] utilise un raccordement DataObjectGroup mode SEDA2.0 " + + "dans un DataObjectGroup mode " + + SedaContext.getVersion() + ); StringType bdoUri = (StringType) bdo.getFirstNamedMetadata("Uri"); bdo.setOnDiskPathFromString(rootDir + File.separator + bdoUri.getValue()); dog.addDataObject(bdo); break; case "PhysicalDataObject": pdo = PhysicalDataObject.fromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); - StringType dataObjectGroupId=(StringType) pdo.getFirstNamedMetadata("DataObjectGroupId"); - StringType dataObjectGroupReferenceId=(StringType) pdo.getFirstNamedMetadata("DataObjectGroupReferenceId"); - if ((dataObjectGroupId != null) || (dataObjectGroupReferenceId != null)) - throw new SEDALibException("Le PhysicalDataObject [" + pdo.inDataPackageObjectId - + "] utilise un raccordement DataObjectGroup mode SEDA2.0 " - + "dans un DataObjectGroup mode " + SedaContext.getVersion()); + StringType dataObjectGroupId = (StringType) pdo.getFirstNamedMetadata("DataObjectGroupId"); + StringType dataObjectGroupReferenceId = (StringType) pdo.getFirstNamedMetadata( + "DataObjectGroupReferenceId" + ); + if ( + (dataObjectGroupId != null) || (dataObjectGroupReferenceId != null) + ) throw new SEDALibException( + "Le PhysicalDataObject [" + + pdo.inDataPackageObjectId + + "] utilise un raccordement DataObjectGroup mode SEDA2.0 " + + "dans un DataObjectGroup mode " + + SedaContext.getVersion() + ); dog.addDataObject(pdo); break; default: @@ -304,12 +322,13 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka xmlReader.endBlockNamed("DataObjectGroup"); } } catch (XMLStreamException | SEDALibException e) { - throw new SEDALibException("Erreur de lecture du DataObjectGroup" - + (dog != null ? " [" + dog.inDataPackageObjectId + "]" : ""), e); + throw new SEDALibException( + "Erreur de lecture du DataObjectGroup" + (dog != null ? " [" + dog.inDataPackageObjectId + "]" : ""), + e + ); } //case not a DataObjectGroup - if (dog == null) - return null; + if (dog == null) return null; return dog.inDataPackageObjectId; } @@ -324,8 +343,10 @@ public static String idFromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPacka public void fromSedaXmlFragments(String fragments) throws SEDALibException { DataObjectGroup dog = new DataObjectGroup(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); String nextElementName = xmlReader.peekName(); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java index 7442b293..d2cf0c66 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackage.java @@ -184,12 +184,9 @@ public DataObjectPackage() { * @return true, if the id is used in DataObjectPackage */ private boolean isInDataObjectPackageIdUsed(String inDataPackageObjectId) { - if (auInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) - return true; - if (dogInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) - return true; - if (bdoInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) - return true; + if (auInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) return true; + if (dogInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) return true; + if (bdoInDataObjectPackageIdMap.containsKey(inDataPackageObjectId)) return true; return pdoInDataObjectPackageIdMap.containsKey(inDataPackageObjectId); } @@ -205,16 +202,25 @@ private boolean isInDataObjectPackageIdUsed(String inDataPackageObjectId) { */ public void addDataObjectPackageIdElement(DataObjectPackageIdElement element) throws SEDALibException { if (element.inDataPackageObjectId == null) element.inDataPackageObjectId = getNextInDataObjectPackageID(); - if (isInDataObjectPackageIdUsed(element.inDataPackageObjectId)) - throw new SEDALibException("Deux objets ne peuvent avoir la même référence [" + element.inDataPackageObjectId + "]"); - if (element instanceof ArchiveUnit) - auInDataObjectPackageIdMap.put(element.inDataPackageObjectId, (ArchiveUnit) element); - else if (element instanceof DataObjectGroup) - dogInDataObjectPackageIdMap.put(element.inDataPackageObjectId, (DataObjectGroup) element); - else if (element instanceof BinaryDataObject) - bdoInDataObjectPackageIdMap.put(element.inDataPackageObjectId, (BinaryDataObject) element); - else if (element instanceof PhysicalDataObject) - pdoInDataObjectPackageIdMap.put(element.inDataPackageObjectId, (PhysicalDataObject) element); + if (isInDataObjectPackageIdUsed(element.inDataPackageObjectId)) throw new SEDALibException( + "Deux objets ne peuvent avoir la même référence [" + element.inDataPackageObjectId + "]" + ); + if (element instanceof ArchiveUnit) auInDataObjectPackageIdMap.put( + element.inDataPackageObjectId, + (ArchiveUnit) element + ); + else if (element instanceof DataObjectGroup) dogInDataObjectPackageIdMap.put( + element.inDataPackageObjectId, + (DataObjectGroup) element + ); + else if (element instanceof BinaryDataObject) bdoInDataObjectPackageIdMap.put( + element.inDataPackageObjectId, + (BinaryDataObject) element + ); + else if (element instanceof PhysicalDataObject) pdoInDataObjectPackageIdMap.put( + element.inDataPackageObjectId, + (PhysicalDataObject) element + ); element.setDataObjectPackage(this); } @@ -230,11 +236,10 @@ else if (element instanceof PhysicalDataObject) * already in the DataObjectPackage */ public void addArchiveUnit(ArchiveUnit au) throws SEDALibException { - if (au.inDataPackageObjectId == null) - au.inDataPackageObjectId = getNextInDataObjectPackageID(); - if (isInDataObjectPackageIdUsed(au.inDataPackageObjectId)) - throw new SEDALibException( - "Deux objets ne peuvent avoir la même référence [" + au.inDataPackageObjectId + "]"); + if (au.inDataPackageObjectId == null) au.inDataPackageObjectId = getNextInDataObjectPackageID(); + if (isInDataObjectPackageIdUsed(au.inDataPackageObjectId)) throw new SEDALibException( + "Deux objets ne peuvent avoir la même référence [" + au.inDataPackageObjectId + "]" + ); auInDataObjectPackageIdMap.put(au.inDataPackageObjectId, au); au.setDataObjectPackage(this); } @@ -251,11 +256,10 @@ public void addArchiveUnit(ArchiveUnit au) throws SEDALibException { * is already in the DataObjectPackage */ public void addDataObjectGroup(DataObjectGroup dog) throws SEDALibException { - if (dog.inDataPackageObjectId == null) - dog.inDataPackageObjectId = getNextInDataObjectPackageID(); - if (isInDataObjectPackageIdUsed(dog.inDataPackageObjectId)) - throw new SEDALibException( - "Deux objets ne peuvent avoir la même référence [" + dog.inDataPackageObjectId + "]"); + if (dog.inDataPackageObjectId == null) dog.inDataPackageObjectId = getNextInDataObjectPackageID(); + if (isInDataObjectPackageIdUsed(dog.inDataPackageObjectId)) throw new SEDALibException( + "Deux objets ne peuvent avoir la même référence [" + dog.inDataPackageObjectId + "]" + ); dogInDataObjectPackageIdMap.put(dog.inDataPackageObjectId, dog); dog.setDataObjectPackage(this); } @@ -301,10 +305,8 @@ public void addTouchedInDataObjectPackageId(String inDataObjectPackageId) { */ public void incTouchedInDataObjectPackageId(String inDataObjectPackageId) { Integer value = touchedInDataObjectPackageIdMap.get(inDataObjectPackageId); - if (value == null) - touchedInDataObjectPackageIdMap.put(inDataObjectPackageId, 1); - else - touchedInDataObjectPackageIdMap.put(inDataObjectPackageId, value + 1); + if (value == null) touchedInDataObjectPackageIdMap.put(inDataObjectPackageId, 1); + else touchedInDataObjectPackageIdMap.put(inDataObjectPackageId, value + 1); } /** @@ -354,8 +356,7 @@ public long getDataObjectsTotalSize() { long result = 0; for (Map.Entry pair : bdoInDataObjectPackageIdMap.entrySet()) { IntegerType size = pair.getValue().getMetadataSize(); - if (size != null) - result += size.getValue(); + if (size != null) result += size.getValue(); } return result; } @@ -399,11 +400,9 @@ public DataObject getDataObjectById(String inDataObjectPackageId) { DataObject dataObject; dataObject = this.dogInDataObjectPackageIdMap.get(inDataObjectPackageId); - if (dataObject != null) - return dataObject; + if (dataObject != null) return dataObject; dataObject = this.bdoInDataObjectPackageIdMap.get(inDataObjectPackageId); - if (dataObject != null) - return dataObject; + if (dataObject != null) return dataObject; dataObject = this.pdoInDataObjectPackageIdMap.get(inDataObjectPackageId); return dataObject; } @@ -418,9 +417,12 @@ public DataObject getDataObjectById(String inDataObjectPackageId) { */ public String getNextInDataObjectPackageID() { String id = "ID" + idCounter++; - while (auInDataObjectPackageIdMap.containsKey(id) || dogInDataObjectPackageIdMap.containsKey(id) - || bdoInDataObjectPackageIdMap.containsKey(id) || pdoInDataObjectPackageIdMap.containsKey(id)) - id = "ID" + idCounter++; + while ( + auInDataObjectPackageIdMap.containsKey(id) || + dogInDataObjectPackageIdMap.containsKey(id) || + bdoInDataObjectPackageIdMap.containsKey(id) || + pdoInDataObjectPackageIdMap.containsKey(id) + ) id = "ID" + idCounter++; return id; } @@ -462,9 +464,8 @@ public void resetIdCounter() { * @return the size in human readable string format */ private static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -480,10 +481,17 @@ private static String readableFileSize(long size) { public String getDescription() { String result; - result = " - " + getArchiveUnitCount() + " ArchiveUnit(s)\n - " + getDataObjectGroupCount() - + " DataObjectGroup(s)\n - " + getBinaryDataObjectCount() + " BinaryDataObject(s) (" - + readableFileSize(getDataObjectsTotalSize()) + ")\n - " + getPhysicalDataObjectCount() - + " PhysicalDataObject(s)"; + result = " - " + + getArchiveUnitCount() + + " ArchiveUnit(s)\n - " + + getDataObjectGroupCount() + + " DataObjectGroup(s)\n - " + + getBinaryDataObjectCount() + + " BinaryDataObject(s) (" + + readableFileSize(getDataObjectsTotalSize()) + + ")\n - " + + getPhysicalDataObjectCount() + + " PhysicalDataObject(s)"; return result; } @@ -526,8 +534,9 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa } } - for (Map.Entry pair : childDataObjectPackage.getDogInDataObjectPackageIdMap() - .entrySet()) { + for (Map.Entry pair : childDataObjectPackage + .getDogInDataObjectPackageIdMap() + .entrySet()) { pair.getValue().setInDataObjectPackageId(null); try { addDataObjectGroup(pair.getValue()); @@ -536,8 +545,9 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa } } - for (Map.Entry pair : childDataObjectPackage.getBdoInDataObjectPackageIdMap() - .entrySet()) { + for (Map.Entry pair : childDataObjectPackage + .getBdoInDataObjectPackageIdMap() + .entrySet()) { pair.getValue().setInDataObjectPackageId(null); try { addDataObjectPackageIdElement(pair.getValue()); @@ -546,8 +556,9 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa } } - for (Map.Entry pair : childDataObjectPackage.getPdoInDataObjectPackageIdMap() - .entrySet()) { + for (Map.Entry pair : childDataObjectPackage + .getPdoInDataObjectPackageIdMap() + .entrySet()) { pair.getValue().setInDataObjectPackageId(null); try { addDataObjectPackageIdElement(pair.getValue()); @@ -556,8 +567,9 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa } } - for (ArchiveUnit au : childDataObjectPackage.ghostRootAu.getChildrenAuList().getArchiveUnitList()) - targetAU.addChildArchiveUnit(au); + for (ArchiveUnit au : childDataObjectPackage.ghostRootAu + .getChildrenAuList() + .getArchiveUnitList()) targetAU.addChildArchiveUnit(au); childDataObjectPackage.setAuInDataObjectPackageIdMap(new HashMap<>()); childDataObjectPackage.setDogInDataObjectPackageIdMap(new HashMap<>()); @@ -572,7 +584,6 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa } childDataObjectPackage.getGhostRootAu().setDataObjectPackage(this); childDataObjectPackage.getGhostRootAu().setContent(c); - } // Test and normalization methods @@ -586,8 +597,7 @@ public void moveContentFromDataObjectPackage(DataObjectPackage childDataObjectPa private String archiveUnitPathToString(List path) { StringBuilder result = new StringBuilder(); if (path != null) { - for (ArchiveUnit au : path) - result.append(au.getInDataObjectPackageId()).append("->"); + for (ArchiveUnit au : path) result.append(au.getInDataObjectPackageId()).append("->"); } return result.toString(); } @@ -600,14 +610,12 @@ private String archiveUnitPathToString(List path) { * @throws SEDALibException if the graph is cyclic */ private void verifyAcyclicArchiveUnit(ArchiveUnit au, List path) throws SEDALibException { - if (path.contains(au)) - throw new SEDALibException( - "Cycle détecté " + archiveUnitPathToString(path) + au.getInDataObjectPackageId()); - if (isTouchedInDataObjectPackageId(au.getInDataObjectPackageId())) - return; + if (path.contains(au)) throw new SEDALibException( + "Cycle détecté " + archiveUnitPathToString(path) + au.getInDataObjectPackageId() + ); + if (isTouchedInDataObjectPackageId(au.getInDataObjectPackageId())) return; path.add(au); - for (ArchiveUnit childAu : au.getChildrenAuList().getArchiveUnitList()) - verifyAcyclicArchiveUnit(childAu, path); + for (ArchiveUnit childAu : au.getChildrenAuList().getArchiveUnitList()) verifyAcyclicArchiveUnit(childAu, path); path.remove(au); addTouchedInDataObjectPackageId(au.getInDataObjectPackageId()); } @@ -620,8 +628,10 @@ private void verifyAcyclicArchiveUnit(ArchiveUnit au, List path) th public void verifyAcyclic() throws SEDALibException { List path = new ArrayList<>(); resetTouchedInDataObjectPackageIdMap(); - for (ArchiveUnit childAu : ghostRootAu.getChildrenAuList().getArchiveUnitList()) - verifyAcyclicArchiveUnit(childAu, path); + for (ArchiveUnit childAu : ghostRootAu.getChildrenAuList().getArchiveUnitList()) verifyAcyclicArchiveUnit( + childAu, + path + ); } /** @@ -631,15 +641,15 @@ public void verifyAcyclic() throws SEDALibException { * @param archiveUnit the ArchiveUnit */ private void countDogReferencesArchiveUnit(ArchiveUnit archiveUnit) { - if (isTouchedInDataObjectPackageId(archiveUnit.getInDataObjectPackageId())) - return; + if (isTouchedInDataObjectPackageId(archiveUnit.getInDataObjectPackageId())) return; for (DataObject zdo : archiveUnit.getDataObjectRefList().getDataObjectList()) { if (zdo instanceof DataObjectGroup) { incTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()); } } - for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) - countDogReferencesArchiveUnit(childAu); + for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) countDogReferencesArchiveUnit( + childAu + ); addTouchedInDataObjectPackageId(archiveUnit.getInDataObjectPackageId()); } @@ -653,21 +663,25 @@ private void countDogReferencesArchiveUnit(ArchiveUnit archiveUnit) { public void verifyDogUnicityCapacity() throws SEDALibException { resetTouchedInDataObjectPackageIdMap(); // count all Dog declaration and reference - for (ArchiveUnit childAu : ghostRootAu.getChildrenAuList().getArchiveUnitList()) - countDogReferencesArchiveUnit(childAu); + for (ArchiveUnit childAu : ghostRootAu.getChildrenAuList().getArchiveUnitList()) countDogReferencesArchiveUnit( + childAu + ); // verify that there is no Dog with reference (count>1) to merge with other // elements in one ArchiveUnit for (Entry pair : getAuInDataObjectPackageIdMap().entrySet()) { DataObjectRefList dorl = pair.getValue().getDataObjectRefList(); boolean referencedDog = false; for (DataObject zdo : dorl.getDataObjectList()) { - if ((zdo instanceof DataObjectGroup) && - (getTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()) > 1)) - referencedDog = true; + if ( + (zdo instanceof DataObjectGroup) && + (getTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()) > 1) + ) referencedDog = true; } - if (referencedDog && (dorl.getCount() > 1)) - throw new SEDALibException("Regroupement des références de DataObject impossible sur l'ArchiveUnit [" - + pair.getValue().getInDataObjectPackageId() + "]"); + if (referencedDog && (dorl.getCount() > 1)) throw new SEDALibException( + "Regroupement des références de DataObject impossible sur l'ArchiveUnit [" + + pair.getValue().getInDataObjectPackageId() + + "]" + ); } } @@ -684,8 +698,9 @@ private void putAllInDog(DataObjectGroup dataObjectGroup, DataObjectRefList dorl if (zdo instanceof DataObjectGroup) { dataObjectGroup.mergeDataObjectGroup((DataObjectGroup) zdo); dogInDataObjectPackageIdMap.remove(zdo.getInDataObjectPackageId()); - } else if ((zdo instanceof BinaryDataObject) || (zdo instanceof PhysicalDataObject)) - dataObjectGroup.addDataObject(zdo); + } else if ( + (zdo instanceof BinaryDataObject) || (zdo instanceof PhysicalDataObject) + ) dataObjectGroup.addDataObject(zdo); } } @@ -703,8 +718,10 @@ public void normalizeUniqDataObjectGroup() throws SEDALibException { for (Entry pair : getAuInDataObjectPackageIdMap().entrySet()) { DataObjectRefList dorl = pair.getValue().getDataObjectRefList(); - if (((dorl.getCount() == 1) && !(dorl.getDataObjectList().get(0) instanceof DataObjectGroup)) - || (dorl.getCount() > 1)) { + if ( + ((dorl.getCount() == 1) && !(dorl.getDataObjectList().get(0) instanceof DataObjectGroup)) || + (dorl.getCount() > 1) + ) { DataObjectGroup dog = new DataObjectGroup(this, null); putAllInDog(dog, pair.getValue().getDataObjectRefList()); dorl = new DataObjectRefList(this); @@ -739,7 +756,14 @@ public void removeUnusedDataObjects(SEDALibProgressLogger spl) throws Interrupte Entry entry = iteratorDog.next(); if (!usedDataObjects.contains(entry.getValue())) { iteratorDog.remove(); - doProgressLog(spl, SEDALibProgressLogger.GLOBAL, "sedalib: un DataObjectGroup [" + entry.getKey() + "] déclaré n'est pas utilisé, il est déréférencé.", null); + doProgressLog( + spl, + SEDALibProgressLogger.GLOBAL, + "sedalib: un DataObjectGroup [" + + entry.getKey() + + "] déclaré n'est pas utilisé, il est déréférencé.", + null + ); } } @@ -748,16 +772,32 @@ public void removeUnusedDataObjects(SEDALibProgressLogger spl) throws Interrupte Entry entry = iteratorBdo.next(); if (!usedDataObjects.contains(entry.getValue())) { iteratorBdo.remove(); - doProgressLog(spl, SEDALibProgressLogger.GLOBAL, "sedalib: un BinaryDataObject [" + entry.getKey() + "] déclaré n'est pas utilisé, il est déréférencé.", null); + doProgressLog( + spl, + SEDALibProgressLogger.GLOBAL, + "sedalib: un BinaryDataObject [" + + entry.getKey() + + "] déclaré n'est pas utilisé, il est déréférencé.", + null + ); } } - Iterator> iteratorPdo = getPdoInDataObjectPackageIdMap().entrySet().iterator(); + Iterator> iteratorPdo = getPdoInDataObjectPackageIdMap() + .entrySet() + .iterator(); while (iteratorPdo.hasNext()) { Entry entry = iteratorPdo.next(); if (!usedDataObjects.contains(entry.getValue())) { iteratorPdo.remove(); - doProgressLog(spl, SEDALibProgressLogger.GLOBAL, "sedalib: un PhysicalDataObject [" + entry.getKey() + "] déclaré n'est pas utilisé, il est déréférencé.", null); + doProgressLog( + spl, + SEDALibProgressLogger.GLOBAL, + "sedalib: un PhysicalDataObject [" + + entry.getKey() + + "] déclaré n'est pas utilisé, il est déréférencé.", + null + ); } } } @@ -772,15 +812,16 @@ public void removeUnusedDataObjects(SEDALibProgressLogger spl) throws Interrupte private void regenerateArchiveUnitId(ArchiveUnit archiveUnit, List orderedDataObjectGroupList) { if (archiveUnit.inDataPackageObjectId == null) { DataObjectGroup dog = archiveUnit.getDataObjectRefList().getNormalizedDataObjectGroup(); - if (dog != null) - orderedDataObjectGroupList.add(dog); + if (dog != null) orderedDataObjectGroupList.add(dog); try { addArchiveUnit(archiveUnit); } catch (SEDALibException ignored) { // impossible } - for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) - regenerateArchiveUnitId(childAu, orderedDataObjectGroupList); + for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) regenerateArchiveUnitId( + childAu, + orderedDataObjectGroupList + ); } } @@ -819,10 +860,12 @@ private void regenerateDataObjectGroup(DataObjectGroup dataObjectGroup) { * Removes the archive unit and data object group ids before regeneration. */ private void removeArchiveUnitAndDataObjectGroupId() { - for (Map.Entry pair : auInDataObjectPackageIdMap.entrySet()) - pair.getValue().setInDataObjectPackageId(null); - for (Map.Entry pair : dogInDataObjectPackageIdMap.entrySet()) - pair.getValue().setInDataObjectPackageId(null); + for (Map.Entry pair : auInDataObjectPackageIdMap.entrySet()) pair + .getValue() + .setInDataObjectPackageId(null); + for (Map.Entry pair : dogInDataObjectPackageIdMap.entrySet()) pair + .getValue() + .setInDataObjectPackageId(null); } /** @@ -840,14 +883,14 @@ public void regenerateContinuousIds() { pdoInDataObjectPackageIdMap = new HashMap<>(); resetInOutCounter(); - List orderedDataObjectGroupList = new ArrayList<>( - dogInDataObjectPackageIdMap.size()); - for (ArchiveUnit root : ghostRootAu.getChildrenAuList().getArchiveUnitList()) - regenerateArchiveUnitId(root, orderedDataObjectGroupList); + List orderedDataObjectGroupList = new ArrayList<>(dogInDataObjectPackageIdMap.size()); + for (ArchiveUnit root : ghostRootAu.getChildrenAuList().getArchiveUnitList()) regenerateArchiveUnitId( + root, + orderedDataObjectGroupList + ); resetInOutCounter(); - for (DataObjectGroup zdo : orderedDataObjectGroupList) - regenerateDataObjectGroup(zdo); + for (DataObjectGroup zdo : orderedDataObjectGroupList) regenerateDataObjectGroup(zdo); } /** @@ -860,14 +903,22 @@ private void actualiseDataObjectId(DataObject dataObject) { if (dataObject instanceof DataObjectGroup) { DataObjectGroup dataObjectGroup = (DataObjectGroup) dataObject; dogInDataObjectPackageIdMap.put(dataObjectGroup.inDataPackageObjectId, dataObjectGroup); - for (BinaryDataObject bdo : dataObjectGroup.getBinaryDataObjectList()) - bdoInDataObjectPackageIdMap.put(bdo.getInDataObjectPackageId(), bdo); - for (PhysicalDataObject pdo : dataObjectGroup.getPhysicalDataObjectList()) - pdoInDataObjectPackageIdMap.put(pdo.getInDataObjectPackageId(), pdo); - } else if (dataObject instanceof BinaryDataObject) - bdoInDataObjectPackageIdMap.put(dataObject.getInDataObjectPackageId(), (BinaryDataObject) dataObject); - else if (dataObject instanceof PhysicalDataObject) - pdoInDataObjectPackageIdMap.put(dataObject.getInDataObjectPackageId(), (PhysicalDataObject) dataObject); + for (BinaryDataObject bdo : dataObjectGroup.getBinaryDataObjectList()) bdoInDataObjectPackageIdMap.put( + bdo.getInDataObjectPackageId(), + bdo + ); + for (PhysicalDataObject pdo : dataObjectGroup.getPhysicalDataObjectList()) pdoInDataObjectPackageIdMap.put( + pdo.getInDataObjectPackageId(), + pdo + ); + } else if (dataObject instanceof BinaryDataObject) bdoInDataObjectPackageIdMap.put( + dataObject.getInDataObjectPackageId(), + (BinaryDataObject) dataObject + ); + else if (dataObject instanceof PhysicalDataObject) pdoInDataObjectPackageIdMap.put( + dataObject.getInDataObjectPackageId(), + (PhysicalDataObject) dataObject + ); } } @@ -883,8 +934,10 @@ private void actualiseArchiveUnitId(ArchiveUnit archiveUnit, List or addTouchedInDataObjectPackageId(archiveUnit.inDataPackageObjectId); orderedDataObjectList.addAll(archiveUnit.getDataObjectRefList().getDataObjectList()); auInDataObjectPackageIdMap.put(archiveUnit.inDataPackageObjectId, archiveUnit); - for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) - actualiseArchiveUnitId(childAu, orderedDataObjectList); + for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) actualiseArchiveUnitId( + childAu, + orderedDataObjectList + ); } } @@ -897,9 +950,8 @@ private void actualiseArchiveUnitId(ArchiveUnit archiveUnit, List or */ public void actualiseIdMaps() { List orderedDataObjectList = new ArrayList<>( - dogInDataObjectPackageIdMap.size() + - bdoInDataObjectPackageIdMap.size() + - pdoInDataObjectPackageIdMap.size()); + dogInDataObjectPackageIdMap.size() + bdoInDataObjectPackageIdMap.size() + pdoInDataObjectPackageIdMap.size() + ); setAllReferencesByObjects(); resetTouchedInDataObjectPackageIdMap(); auInDataObjectPackageIdMap = new HashMap<>(); @@ -907,10 +959,11 @@ public void actualiseIdMaps() { bdoInDataObjectPackageIdMap = new HashMap<>(); pdoInDataObjectPackageIdMap = new HashMap<>(); - for (ArchiveUnit root : ghostRootAu.getChildrenAuList().getArchiveUnitList()) - actualiseArchiveUnitId(root, orderedDataObjectList); - for (DataObject dataObject : orderedDataObjectList) - actualiseDataObjectId(dataObject); + for (ArchiveUnit root : ghostRootAu.getChildrenAuList().getArchiveUnitList()) actualiseArchiveUnitId( + root, + orderedDataObjectList + ); + for (DataObject dataObject : orderedDataObjectList) actualiseDataObjectId(dataObject); } /** @@ -936,22 +989,19 @@ public void vitamNormalize(SEDALibProgressLogger spl) throws SEDALibException, I vitamNormalizationStatus = NORMALIZATION_STATUS_OK; } - /** * Remove empty (no child archive unit, no data object) archive unit from all it's fathers and from the data object package. * * @param archiveUnit the empty archive unit * @return true if it's done, false if it's not possible (not empty or not found) */ - public boolean removeEmptyArchiveUnit(ArchiveUnit archiveUnit){ - if (archiveUnit.getChildrenAuList().getCount()!=0) - return false; - if (archiveUnit.getDataObjectRefList().getCount()!=0) - return false; - for (Map.Entry e:auInDataObjectPackageIdMap.entrySet()){ + public boolean removeEmptyArchiveUnit(ArchiveUnit archiveUnit) { + if (archiveUnit.getChildrenAuList().getCount() != 0) return false; + if (archiveUnit.getDataObjectRefList().getCount() != 0) return false; + for (Map.Entry e : auInDataObjectPackageIdMap.entrySet()) { e.getValue().getChildrenAuList().getArchiveUnitList().remove(archiveUnit); } - return auInDataObjectPackageIdMap.remove(archiveUnit.inDataPackageObjectId)!=null; + return auInDataObjectPackageIdMap.remove(archiveUnit.inDataPackageObjectId) != null; } // SEDA XML exporter @@ -982,8 +1032,10 @@ public boolean removeEmptyArchiveUnit(ArchiveUnit archiveUnit){ * @throws InterruptedException if export process is interrupted * @throws SEDALibException if the XML can't be written */ - public void exportDataObjectPackageObjects(SEDAXMLStreamWriter xmlWriter, SEDALibProgressLogger sedaLibProgressLogger) - throws InterruptedException, SEDALibException { + public void exportDataObjectPackageObjects( + SEDAXMLStreamWriter xmlWriter, + SEDALibProgressLogger sedaLibProgressLogger + ) throws InterruptedException, SEDALibException { try { xmlWriter.writeStartElement("DataObjectPackage"); DataObjectGroup dog; @@ -999,10 +1051,12 @@ public void exportDataObjectPackageObjects(SEDAXMLStreamWriter xmlWriter, SEDALi for (String s : tempArray) { dog = dogInDataObjectPackageIdMap.get(s); dog.toSedaXml(xmlWriter, sedaLibProgressLogger); - for (BinaryDataObject b : dog.getBinaryDataObjectList()) - addTouchedInDataObjectPackageId(b.inDataPackageObjectId); - for (PhysicalDataObject p : dog.getPhysicalDataObjectList()) - addTouchedInDataObjectPackageId(p.inDataPackageObjectId); + for (BinaryDataObject b : dog.getBinaryDataObjectList()) addTouchedInDataObjectPackageId( + b.inDataPackageObjectId + ); + for (PhysicalDataObject p : dog.getPhysicalDataObjectList()) addTouchedInDataObjectPackageId( + p.inDataPackageObjectId + ); } // then all alone BinaryDataObject @@ -1011,8 +1065,10 @@ public void exportDataObjectPackageObjects(SEDAXMLStreamWriter xmlWriter, SEDALi Arrays.sort(tempArray); for (String s : tempArray) { bdo = bdoInDataObjectPackageIdMap.get(s); - if (!isTouchedInDataObjectPackageId(bdo.inDataPackageObjectId)) - bdo.toSedaXml(xmlWriter, sedaLibProgressLogger); + if (!isTouchedInDataObjectPackageId(bdo.inDataPackageObjectId)) bdo.toSedaXml( + xmlWriter, + sedaLibProgressLogger + ); } // and at last all alone PhysicalDataObject @@ -1021,14 +1077,20 @@ public void exportDataObjectPackageObjects(SEDAXMLStreamWriter xmlWriter, SEDALi Arrays.sort(tempArray); for (String s : tempArray) { pdo = pdoInDataObjectPackageIdMap.get(s); - if (!isTouchedInDataObjectPackageId(pdo.inDataPackageObjectId)) - pdo.toSedaXml(xmlWriter, sedaLibProgressLogger); + if (!isTouchedInDataObjectPackageId(pdo.inDataPackageObjectId)) pdo.toSedaXml( + xmlWriter, + sedaLibProgressLogger + ); } } catch (XMLStreamException e) { throw new SEDALibException("Erreur d'écriture XML des métadonnées des DataObjects", e); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - "sedalib: " + getNextInOutCounter() + " métadonnées DataObject exportées dans le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: " + getNextInOutCounter() + " métadonnées DataObject exportées dans le DataObjectPackage", + null + ); } /** @@ -1043,8 +1105,11 @@ public void exportDataObjectPackageObjects(SEDAXMLStreamWriter xmlWriter, SEDALi * @throws SEDALibException if the XML can't be written * @throws InterruptedException if export process is interrupted */ - public void exportDataObjectPackageMetadata(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public void exportDataObjectPackageMetadata( + SEDAXMLStreamWriter xmlWriter, + boolean imbricateFlag, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { try { resetTouchedInDataObjectPackageIdMap(); xmlWriter.writeStartElement("DescriptiveMetadata"); @@ -1052,8 +1117,9 @@ public void exportDataObjectPackageMetadata(SEDAXMLStreamWriter xmlWriter, boole Set auSet = auInDataObjectPackageIdMap.keySet(); String[] tempArray = auSet.toArray(new String[0]); Arrays.sort(tempArray, idComparator); - for (String s : tempArray) - auInDataObjectPackageIdMap.get(s).toSedaXml(xmlWriter, false, sedaLibProgressLogger); + for (String s : tempArray) auInDataObjectPackageIdMap + .get(s) + .toSedaXml(xmlWriter, false, sedaLibProgressLogger); } else { List roots = ghostRootAu.getChildrenAuList().getInDataObjectPackageIdList(); if (roots != null) { @@ -1065,17 +1131,19 @@ public void exportDataObjectPackageMetadata(SEDAXMLStreamWriter xmlWriter, boole } } xmlWriter.writeEndElement(); - if (managementMetadataXmlData!=null) - xmlWriter.writeRawXMLBlockIfNotEmpty(managementMetadataXmlData); - else - xmlWriter.writeRawXMLBlockIfNotEmpty(""); + if (managementMetadataXmlData != null) xmlWriter.writeRawXMLBlockIfNotEmpty(managementMetadataXmlData); + else xmlWriter.writeRawXMLBlockIfNotEmpty(""); xmlWriter.writeEndElement(); xmlWriter.flush(); } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur d'écriture XML des métadonnées dans le DataObjectPackage", e); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, "sedalib: " + getNextInOutCounter() + - " métadonnées ArchiveUnit exportées dans le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: " + getNextInOutCounter() + " métadonnées ArchiveUnit exportées dans le DataObjectPackage", + null + ); } /** @@ -1089,8 +1157,11 @@ public void exportDataObjectPackageMetadata(SEDAXMLStreamWriter xmlWriter, boole * @throws SEDALibException if the XML can't be written * @throws InterruptedException if export process is interrupted */ - public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException, InterruptedException { + public void toSedaXml( + SEDAXMLStreamWriter xmlWriter, + boolean imbricateFlag, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { resetRefIdCounter(); resetInOutCounter(); exportDataObjectPackageObjects(xmlWriter, sedaLibProgressLogger); @@ -1111,33 +1182,56 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter, boolean imbricateFlag, SEDA * respected * @throws InterruptedException if export process is interrupted */ - public static void importDataObjectPackageObjects(SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - String rootDir, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static void importDataObjectPackageObjects( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + String rootDir, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { String tmp; BinaryDataObject bdo; PhysicalDataObject pdo; boolean inDataObjectObjects = true; try { - if (!xmlReader.nextBlockIfNamed("DataObjectPackage")) - throw new SEDALibException("Pas d'élément DataObjectPackage"); + if (!xmlReader.nextBlockIfNamed("DataObjectPackage")) throw new SEDALibException( + "Pas d'élément DataObjectPackage" + ); while (inDataObjectObjects) { tmp = xmlReader.peekName(); switch (tmp) { case "DataObjectGroup": - String dogId = DataObjectGroup.idFromSedaXml(xmlReader, dataObjectPackage, rootDir, sedaLibProgressLogger); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: DataObjectGroup [" + dogId + "] " + - "importé", null); + String dogId = DataObjectGroup.idFromSedaXml( + xmlReader, + dataObjectPackage, + rootDir, + sedaLibProgressLogger + ); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: DataObjectGroup [" + dogId + "] " + "importé", + null + ); break; case "BinaryDataObject": bdo = BinaryDataObject.fromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); - bdo.setOnDiskPathFromString(rootDir + File.separator + bdo.getMetadataUri().getValue()); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: BinaryDataObject [" + bdo.inDataPackageObjectId + "] importé", null); + bdo.setOnDiskPathFromString(rootDir + File.separator + bdo.getMetadataUri().getValue()); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: BinaryDataObject [" + bdo.inDataPackageObjectId + "] importé", + null + ); break; case "PhysicalDataObject": pdo = PhysicalDataObject.fromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: PhysicalDataObject [" + pdo.inDataPackageObjectId + - "] importé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: PhysicalDataObject [" + pdo.inDataPackageObjectId + "] importé", + null + ); break; default: inDataObjectObjects = false; @@ -1146,8 +1240,14 @@ public static void importDataObjectPackageObjects(SEDAXMLEventReader xmlReader, } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture des métadonnées des DataObjects", e); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, - "sedalib: " + dataObjectPackage.getNextInOutCounter() + " métadonnées DataObject importées depuis le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + + dataObjectPackage.getNextInOutCounter() + + " métadonnées DataObject importées depuis le DataObjectPackage", + null + ); } /** @@ -1161,22 +1261,29 @@ public static void importDataObjectPackageObjects(SEDAXMLEventReader xmlReader, * respected * @throws InterruptedException if export process is interrupted */ - public static void importDataObjectPackageMetadata(SEDAXMLEventReader xmlReader, - DataObjectPackage dataObjectPackage, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException, InterruptedException { + public static void importDataObjectPackageMetadata( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { String tmp; boolean inArchiveUnits = true; try { - if (!xmlReader.nextBlockIfNamed("DescriptiveMetadata")) - throw new SEDALibException("Pas d'élément DescriptiveMetadata"); + if (!xmlReader.nextBlockIfNamed("DescriptiveMetadata")) throw new SEDALibException( + "Pas d'élément DescriptiveMetadata" + ); while (inArchiveUnits) { tmp = xmlReader.peekName(); - if (tmp == null) - break; + if (tmp == null) break; if ("ArchiveUnit".equals(tmp)) { String auId = ArchiveUnit.idFromSedaXml(xmlReader, dataObjectPackage, sedaLibProgressLogger); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: ArchiveUnit [" + auId + "] importé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: ArchiveUnit [" + auId + "] importé", + null + ); } else { inArchiveUnits = false; } @@ -1187,8 +1294,14 @@ public static void importDataObjectPackageMetadata(SEDAXMLEventReader xmlReader, } catch (XMLStreamException | SEDALibException e) { throw new SEDALibException("Erreur de lecture des métadonnées des ArchiveUnits", e); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, - "sedalib: " + dataObjectPackage.getNextInOutCounter() + " métadonnées ArchiveUnit importées depuis le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + + dataObjectPackage.getNextInOutCounter() + + " métadonnées ArchiveUnit importées depuis le DataObjectPackage", + null + ); } /** @@ -1203,8 +1316,11 @@ public static void importDataObjectPackageMetadata(SEDAXMLEventReader xmlReader, * respected * @throws InterruptedException if export process is interrupted */ - public static DataObjectPackage fromSedaXml(SEDAXMLEventReader xmlReader, String rootDir, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static DataObjectPackage fromSedaXml( + SEDAXMLEventReader xmlReader, + String rootDir, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { DataObjectPackage dataObjectPackage = new DataObjectPackage(); dataObjectPackage.resetInOutCounter(); importDataObjectPackageObjects(xmlReader, dataObjectPackage, rootDir, sedaLibProgressLogger); @@ -1216,18 +1332,18 @@ public static DataObjectPackage fromSedaXml(SEDAXMLEventReader xmlReader, String ArchiveUnit tmp; for (Map.Entry pair : dataObjectPackage.auInDataObjectPackageIdMap.entrySet()) { tmp = pair.getValue(); - if ((tmp.getChildrenAuList() != null) && (tmp.getChildrenAuList().getInDataObjectPackageIdList() != null)) - for (String inDataObjectPackageId : pair.getValue().getChildrenAuList().getInDataObjectPackageIdList()) { - if (dataObjectPackage.getArchiveUnitById(inDataObjectPackageId) == null) - throw new SEDALibException( - "Erreur de référence d'ArchiveUnit, [" + inDataObjectPackageId + "] n'existe pas"); - dataObjectPackage.addTouchedInDataObjectPackageId(inDataObjectPackageId); - } + if ( + (tmp.getChildrenAuList() != null) && (tmp.getChildrenAuList().getInDataObjectPackageIdList() != null) + ) for (String inDataObjectPackageId : pair.getValue().getChildrenAuList().getInDataObjectPackageIdList()) { + if (dataObjectPackage.getArchiveUnitById(inDataObjectPackageId) == null) throw new SEDALibException( + "Erreur de référence d'ArchiveUnit, [" + inDataObjectPackageId + "] n'existe pas" + ); + dataObjectPackage.addTouchedInDataObjectPackageId(inDataObjectPackageId); + } } - for (Map.Entry pair : dataObjectPackage.auInDataObjectPackageIdMap.entrySet()) - if (!dataObjectPackage.isTouchedInDataObjectPackageId(pair.getValue().inDataPackageObjectId)) - dataObjectPackage - .addRootAu(dataObjectPackage.getArchiveUnitById(pair.getValue().inDataPackageObjectId)); + for (Map.Entry pair : dataObjectPackage.auInDataObjectPackageIdMap.entrySet()) if ( + !dataObjectPackage.isTouchedInDataObjectPackageId(pair.getValue().inDataPackageObjectId) + ) dataObjectPackage.addRootAu(dataObjectPackage.getArchiveUnitById(pair.getValue().inDataPackageObjectId)); doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: manifest importé", null); @@ -1356,13 +1472,13 @@ public void setGhostRootAu(ArchiveUnit ghostRootAu) { * @param originArchiveUnit the origin archive unit * @param newArchiveUnit the new archive unit */ - public void replaceArchiveUnitBy(ArchiveUnit originArchiveUnit,ArchiveUnit newArchiveUnit){ + public void replaceArchiveUnitBy(ArchiveUnit originArchiveUnit, ArchiveUnit newArchiveUnit) { if (ghostRootAu.getChildrenAuList().getArchiveUnitList().contains(originArchiveUnit)) { - ghostRootAu.replaceChildArchiveUnit(originArchiveUnit,newArchiveUnit); + ghostRootAu.replaceChildArchiveUnit(originArchiveUnit, newArchiveUnit); } for (ArchiveUnit au : auInDataObjectPackageIdMap.values()) { if (au.getChildrenAuList().getArchiveUnitList().contains(originArchiveUnit)) { - au.replaceChildArchiveUnit(originArchiveUnit,newArchiveUnit); + au.replaceChildArchiveUnit(originArchiveUnit, newArchiveUnit); } } actualiseIdMaps(); @@ -1452,4 +1568,4 @@ public List getExportMetadataList() { public void setExportMetadataList(List exportMetadataList) { this.exportMetadataList = exportMetadataList; } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java index e84c7ab3..28963e2f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageIdElement.java @@ -116,10 +116,8 @@ public Path getOnDiskPath() { */ @JsonIgnore public void setOnDiskPath(Path onDiskPath) { - if (onDiskPath == null) - this.onDiskPath = null; - else - this.onDiskPath = onDiskPath.toAbsolutePath().normalize(); + if (onDiskPath == null) this.onDiskPath = null; + else this.onDiskPath = onDiskPath.toAbsolutePath().normalize(); } /** @@ -129,10 +127,8 @@ public void setOnDiskPath(Path onDiskPath) { */ @JsonGetter("onDiskPath") public String getOnDiskPathToString() { - if (onDiskPath == null) - return null; - else - return onDiskPath.toString(); + if (onDiskPath == null) return null; + else return onDiskPath.toString(); } /** @@ -142,11 +138,7 @@ public String getOnDiskPathToString() { */ @JsonSetter("onDiskPath") public void setOnDiskPathFromString(String onDiskPathString) { - if (onDiskPathString == null) - this.onDiskPath = null; - else - this.onDiskPath = Paths.get(onDiskPathString).toAbsolutePath().normalize(); + if (onDiskPathString == null) this.onDiskPath = null; + else this.onDiskPath = Paths.get(onDiskPathString).toAbsolutePath().normalize(); } - - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java index 5750b295..b1522fa2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/DataObjectRefList.java @@ -90,14 +90,13 @@ public DataObjectRefList(DataObjectPackage dataObjectPackage) { * @return the inDataPackageObjectId list */ public ArrayList getInDataObjectPackageIdList() { - if (inDataObjectPackageIdList != null) - return inDataObjectPackageIdList; - if (dataObjectList == null) - inDataObjectPackageIdList = new ArrayList<>(0); + if (inDataObjectPackageIdList != null) return inDataObjectPackageIdList; + if (dataObjectList == null) inDataObjectPackageIdList = new ArrayList<>(0); else { inDataObjectPackageIdList = new ArrayList<>(dataObjectList.size()); - for (DataObject dataObject : dataObjectList) - inDataObjectPackageIdList.add(dataObject.getInDataObjectPackageId()); + for (DataObject dataObject : dataObjectList) inDataObjectPackageIdList.add( + dataObject.getInDataObjectPackageId() + ); } dataObjectList = null; return inDataObjectPackageIdList; @@ -119,14 +118,13 @@ public void setInDataObjectPackageIdList(ArrayList inDataObjectPackageId * @return the DataObject list */ public List getDataObjectList() { - if (dataObjectList != null) - return dataObjectList; - if (inDataObjectPackageIdList == null) - dataObjectList = new ArrayList<>(0); + if (dataObjectList != null) return dataObjectList; + if (inDataObjectPackageIdList == null) dataObjectList = new ArrayList<>(0); else { dataObjectList = new ArrayList<>(inDataObjectPackageIdList.size()); - for (String inSipId : inDataObjectPackageIdList) - dataObjectList.add(getDataObjectPackage().getDataObjectById(inSipId)); + for (String inSipId : inDataObjectPackageIdList) dataObjectList.add( + getDataObjectPackage().getDataObjectById(inSipId) + ); } inDataObjectPackageIdList = null; return dataObjectList; @@ -185,10 +183,8 @@ public void removeById(String inDataObjectPackageId) { */ @JsonIgnore public int getCount() { - if (inDataObjectPackageIdList != null) - return inDataObjectPackageIdList.size(); - else if (dataObjectList != null) - return dataObjectList.size(); + if (inDataObjectPackageIdList != null) return inDataObjectPackageIdList.size(); + else if (dataObjectList != null) return dataObjectList.size(); return 0; } @@ -200,10 +196,8 @@ else if (dataObjectList != null) @JsonIgnore public DataObjectGroup getNormalizedDataObjectGroup() { getDataObjectList(); - if (dataObjectList.size() != 1) - return null; - if (dataObjectList.get(0) instanceof DataObjectGroup) - return (DataObjectGroup) dataObjectList.get(0); + if (dataObjectList.size() != 1) return null; + if (dataObjectList.get(0) instanceof DataObjectGroup) return (DataObjectGroup) dataObjectList.get(0); return null; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java index 62700c54..38206649 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadata.java @@ -154,9 +154,11 @@ public GlobalMetadata(GlobalMetadata globalMetadata) { this.codeListVersionsXmlData = globalMetadata.codeListVersionsXmlData; this.transferRequestReplyIdentifier = globalMetadata.transferRequestReplyIdentifier; this.archivalAgencyIdentifier = globalMetadata.archivalAgencyIdentifier; - this.archivalAgencyOrganizationDescriptiveMetadataXmlData = globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData; + this.archivalAgencyOrganizationDescriptiveMetadataXmlData = + globalMetadata.archivalAgencyOrganizationDescriptiveMetadataXmlData; this.transferringAgencyIdentifier = globalMetadata.transferringAgencyIdentifier; - this.transferringAgencyOrganizationDescriptiveMetadataXmlData = globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData; + this.transferringAgencyOrganizationDescriptiveMetadataXmlData = + globalMetadata.transferringAgencyOrganizationDescriptiveMetadataXmlData; } // Methods @@ -172,11 +174,12 @@ public GlobalMetadata(GlobalMetadata globalMetadata) { */ public String toSedaXmlFragments() throws SEDALibException { String result; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2, true)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2, true) + ) { xmlWriter.writeElementValueIfNotEmpty("Comment", comment); - if (!isNowFlag()) - xmlWriter.writeElementValueIfNotEmpty("Date", date); + if (!isNowFlag()) xmlWriter.writeElementValueIfNotEmpty("Date", date); xmlWriter.writeElementValueIfNotEmpty("MessageIdentifier", messageIdentifier); xmlWriter.writeElementValueIfNotEmpty("ArchivalAgreement", archivalAgreement); xmlWriter.writeRawXMLBlockIfNotEmpty(codeListVersionsXmlData); @@ -208,8 +211,7 @@ public String toSedaXmlFragments() throws SEDALibException { * @throws SEDALibException if the XML can't be read or the SEDA scheme is not * respected */ - private void setFromXmlContent(SEDAXMLEventReader xmlReader) - throws SEDALibException { + private void setFromXmlContent(SEDAXMLEventReader xmlReader) throws SEDALibException { try { comment = xmlReader.nextValueIfNamed("Comment"); date = xmlReader.nextValueIfNamed("Date"); @@ -220,14 +222,16 @@ private void setFromXmlContent(SEDAXMLEventReader xmlReader) transferRequestReplyIdentifier = xmlReader.nextValueIfNamed("TransferRequestReplyIdentifier"); if (xmlReader.nextBlockIfNamed("ArchivalAgency")) { archivalAgencyIdentifier = xmlReader.nextValueIfNamed("Identifier"); - archivalAgencyOrganizationDescriptiveMetadataXmlData = xmlReader - .nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); + archivalAgencyOrganizationDescriptiveMetadataXmlData = xmlReader.nextBlockAsStringIfNamed( + "OrganizationDescriptiveMetadata" + ); xmlReader.endBlockNamed("ArchivalAgency"); } if (xmlReader.nextBlockIfNamed("TransferringAgency")) { transferringAgencyIdentifier = xmlReader.nextValueIfNamed("Identifier"); - transferringAgencyOrganizationDescriptiveMetadataXmlData = xmlReader - .nextBlockAsStringIfNamed("OrganizationDescriptiveMetadata"); + transferringAgencyOrganizationDescriptiveMetadataXmlData = xmlReader.nextBlockAsStringIfNamed( + "OrganizationDescriptiveMetadata" + ); xmlReader.endBlockNamed("TransferringAgency"); } } catch (XMLStreamException e) { @@ -246,14 +250,15 @@ private void setFromXmlContent(SEDAXMLEventReader xmlReader) public void fromSedaXmlFragments(String fragments) throws SEDALibException { GlobalMetadata gm = new GlobalMetadata(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(fragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); gm.setFromXmlContent(xmlReader); XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new SEDALibException("Il y a des champs illégaux"); + if (!event.isEndDocument()) throw new SEDALibException("Il y a des champs illégaux"); } catch (XMLStreamException | SEDALibException | IOException e) { throw new SEDALibException("Erreur de lecture du GlobalMetadata", e); } @@ -266,198 +271,200 @@ public void fromSedaXmlFragments(String fragments) throws SEDALibException { this.codeListVersionsXmlData = gm.codeListVersionsXmlData; this.transferRequestReplyIdentifier = gm.transferRequestReplyIdentifier; this.archivalAgencyIdentifier = gm.archivalAgencyIdentifier; - this.archivalAgencyOrganizationDescriptiveMetadataXmlData = gm.archivalAgencyOrganizationDescriptiveMetadataXmlData; + this.archivalAgencyOrganizationDescriptiveMetadataXmlData = + gm.archivalAgencyOrganizationDescriptiveMetadataXmlData; this.transferringAgencyIdentifier = gm.transferringAgencyIdentifier; - this.transferringAgencyOrganizationDescriptiveMetadataXmlData = gm.transferringAgencyOrganizationDescriptiveMetadataXmlData; + this.transferringAgencyOrganizationDescriptiveMetadataXmlData = + gm.transferringAgencyOrganizationDescriptiveMetadataXmlData; } // Getters and setters -// /** -// * Gets the message identifier. -// * -// * @return the message identifier -// */ -// public String getMessageIdentifier() { -// return messageIdentifier; -// } -// -// /** -// * Sets the message identifier. -// * -// * @param messageIdentifier the new message identifier -// */ -// public void setMessageIdentifier(String messageIdentifier) { -// this.messageIdentifier = messageIdentifier; -// } -// -// /** -// * Gets the comment. -// * -// * @return the comment -// */ -// public String getComment() { -// return comment; -// } -// -// /** -// * Sets the comment. -// * -// * @param comment the new comment -// */ -// public void setComment(String comment) { -// this.comment = comment; -// } -// -// /** -// * Gets the date. -// * -// * @return the date -// */ -// public String getDate() { -// return date; -// } -// -// /** -// * Sets the date. -// * -// * @param date the new date -// */ -// public void setDate(String date) { -// this.date = date; -// } -// -// /** -// * Gets the archival agreement. -// * -// * @return the archival agreement -// */ -// public String getArchivalAgreement() { -// return archivalAgreement; -// } -// -// /** -// * Sets the archival agreement. -// * -// * @param archivalAgreement the new archival agreement -// */ -// public void setArchivalAgreement(String archivalAgreement) { -// this.archivalAgreement = archivalAgreement; -// } -// -// /** -// * Gets the code list versions xml data. -// * -// * @return the code list versions xml data -// */ -// public String getCodeListVersionsXmlData() { -// return codeListVersionsXmlData; -// } -// -// /** -// * Sets the code list versions xml data. -// * -// * @param codeListVersionsXmlString the new code list versions xml data -// */ -// public void setCodeListVersionsXmlData(String codeListVersionsXmlString) { -// this.codeListVersionsXmlData = codeListVersionsXmlString; -// } -// -// /** -// * Gets the transfer request reply identifier. -// * -// * @return the transfer request reply identifier -// */ -// public String getTransferRequestReplyIdentifier() { -// return transferRequestReplyIdentifier; -// } -// -// /** -// * Sets the transfer request reply identifier. -// * -// * @param transferRequestReplyIdentifier the new transfer request reply -// * identifier -// */ -// public void setTransferRequestReplyIdentifier(String transferRequestReplyIdentifier) { -// this.transferRequestReplyIdentifier = transferRequestReplyIdentifier; -// } -// -// /** -// * Gets the archival agency identifier. -// * -// * @return the archival agency identifier -// */ -// public String getArchivalAgencyIdentifier() { -// return archivalAgencyIdentifier; -// } -// -// /** -// * Sets the archival agency identifier. -// * -// * @param archivalAgencyIdentifier the new archival agency identifier -// */ -// public void setArchivalAgencyIdentifier(String archivalAgencyIdentifier) { -// this.archivalAgencyIdentifier = archivalAgencyIdentifier; -// } -// -// /** -// * Gets the archival agency organization descriptive metadata. -// * -// * @return the archival agency organization descriptive metadata -// */ -// public String getArchivalAgencyOrganizationDescriptiveMetadataXmlData() { -// return archivalAgencyOrganizationDescriptiveMetadataXmlData; -// } -// -// /** -// * Sets the archival agency organization descriptive metadata. -// * -// * @param archivalAgencyOrganizationDescriptiveMetadataXmlData the new archival agency -// * organization descriptive -// * metadata -// */ -// public void setArchivalAgencyOrganizationDescriptiveMetadataXmlData(String archivalAgencyOrganizationDescriptiveMetadata) { -// this.archivalAgencyOrganizationDescriptiveMetadataXmlData = archivalAgencyOrganizationDescriptiveMetadata; -// } -// -// /** -// * Gets the transferring agency identifier. -// * -// * @return the transferring agency identifier -// */ -// public String getTransferringAgencyIdentifier() { -// return transferringAgencyIdentifier; -// } -// -// /** -// * Sets the transferring agency identifier. -// * -// * @param transferringAgencyIdentifier the new transferring agency identifier -// */ -// public void setTransferringAgencyIdentifier(String transferringAgencyIdentifier) { -// this.transferringAgencyIdentifier = transferringAgencyIdentifier; -// } -// -// /** -// * Gets the transferring agency organization descriptive metadata. -// * -// * @return the transferring agency organization descriptive metadata -// */ -// public String getTransferringAgencyOrganizationDescriptiveMetadataXmlData() { -// return transferringAgencyOrganizationDescriptiveMetadataXmlData; -// } -// -// /** -// * Sets the transferring agency organization descriptive metadata. -// * -// * @param transferringAgencyOrganizationDescriptiveMetadataXmlData the new transferring -// * agency organization -// * descriptive metadata -// */ -// public void setTransferringAgencyOrganizationDescriptiveMetadataXmlData( -// String transferringAgencyOrganizationDescriptiveMetadata) { -// this.transferringAgencyOrganizationDescriptiveMetadataXmlData = transferringAgencyOrganizationDescriptiveMetadata; -// } + // /** + // * Gets the message identifier. + // * + // * @return the message identifier + // */ + // public String getMessageIdentifier() { + // return messageIdentifier; + // } + // + // /** + // * Sets the message identifier. + // * + // * @param messageIdentifier the new message identifier + // */ + // public void setMessageIdentifier(String messageIdentifier) { + // this.messageIdentifier = messageIdentifier; + // } + // + // /** + // * Gets the comment. + // * + // * @return the comment + // */ + // public String getComment() { + // return comment; + // } + // + // /** + // * Sets the comment. + // * + // * @param comment the new comment + // */ + // public void setComment(String comment) { + // this.comment = comment; + // } + // + // /** + // * Gets the date. + // * + // * @return the date + // */ + // public String getDate() { + // return date; + // } + // + // /** + // * Sets the date. + // * + // * @param date the new date + // */ + // public void setDate(String date) { + // this.date = date; + // } + // + // /** + // * Gets the archival agreement. + // * + // * @return the archival agreement + // */ + // public String getArchivalAgreement() { + // return archivalAgreement; + // } + // + // /** + // * Sets the archival agreement. + // * + // * @param archivalAgreement the new archival agreement + // */ + // public void setArchivalAgreement(String archivalAgreement) { + // this.archivalAgreement = archivalAgreement; + // } + // + // /** + // * Gets the code list versions xml data. + // * + // * @return the code list versions xml data + // */ + // public String getCodeListVersionsXmlData() { + // return codeListVersionsXmlData; + // } + // + // /** + // * Sets the code list versions xml data. + // * + // * @param codeListVersionsXmlString the new code list versions xml data + // */ + // public void setCodeListVersionsXmlData(String codeListVersionsXmlString) { + // this.codeListVersionsXmlData = codeListVersionsXmlString; + // } + // + // /** + // * Gets the transfer request reply identifier. + // * + // * @return the transfer request reply identifier + // */ + // public String getTransferRequestReplyIdentifier() { + // return transferRequestReplyIdentifier; + // } + // + // /** + // * Sets the transfer request reply identifier. + // * + // * @param transferRequestReplyIdentifier the new transfer request reply + // * identifier + // */ + // public void setTransferRequestReplyIdentifier(String transferRequestReplyIdentifier) { + // this.transferRequestReplyIdentifier = transferRequestReplyIdentifier; + // } + // + // /** + // * Gets the archival agency identifier. + // * + // * @return the archival agency identifier + // */ + // public String getArchivalAgencyIdentifier() { + // return archivalAgencyIdentifier; + // } + // + // /** + // * Sets the archival agency identifier. + // * + // * @param archivalAgencyIdentifier the new archival agency identifier + // */ + // public void setArchivalAgencyIdentifier(String archivalAgencyIdentifier) { + // this.archivalAgencyIdentifier = archivalAgencyIdentifier; + // } + // + // /** + // * Gets the archival agency organization descriptive metadata. + // * + // * @return the archival agency organization descriptive metadata + // */ + // public String getArchivalAgencyOrganizationDescriptiveMetadataXmlData() { + // return archivalAgencyOrganizationDescriptiveMetadataXmlData; + // } + // + // /** + // * Sets the archival agency organization descriptive metadata. + // * + // * @param archivalAgencyOrganizationDescriptiveMetadataXmlData the new archival agency + // * organization descriptive + // * metadata + // */ + // public void setArchivalAgencyOrganizationDescriptiveMetadataXmlData(String archivalAgencyOrganizationDescriptiveMetadata) { + // this.archivalAgencyOrganizationDescriptiveMetadataXmlData = archivalAgencyOrganizationDescriptiveMetadata; + // } + // + // /** + // * Gets the transferring agency identifier. + // * + // * @return the transferring agency identifier + // */ + // public String getTransferringAgencyIdentifier() { + // return transferringAgencyIdentifier; + // } + // + // /** + // * Sets the transferring agency identifier. + // * + // * @param transferringAgencyIdentifier the new transferring agency identifier + // */ + // public void setTransferringAgencyIdentifier(String transferringAgencyIdentifier) { + // this.transferringAgencyIdentifier = transferringAgencyIdentifier; + // } + // + // /** + // * Gets the transferring agency organization descriptive metadata. + // * + // * @return the transferring agency organization descriptive metadata + // */ + // public String getTransferringAgencyOrganizationDescriptiveMetadataXmlData() { + // return transferringAgencyOrganizationDescriptiveMetadataXmlData; + // } + // + // /** + // * Sets the transferring agency organization descriptive metadata. + // * + // * @param transferringAgencyOrganizationDescriptiveMetadataXmlData the new transferring + // * agency organization + // * descriptive metadata + // */ + // public void setTransferringAgencyOrganizationDescriptiveMetadataXmlData( + // String transferringAgencyOrganizationDescriptiveMetadata) { + // this.transferringAgencyOrganizationDescriptiveMetadataXmlData = transferringAgencyOrganizationDescriptiveMetadata; + // } /** * Checks if is now flag. diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java index e3bc10d3..8530a8f8 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObject.java @@ -115,8 +115,7 @@ public class PhysicalDataObject extends AbstractUnitaryDataObject implements Dat @JsonIgnore @Override public LinkedHashMap getMetadataMap() throws SEDALibException { - return (LinkedHashMap) ComplexListInterface - .getMetadataMap(this.getClass()); + return (LinkedHashMap) ComplexListInterface.getMetadataMap(this.getClass()); } /** @@ -125,8 +124,7 @@ public LinkedHashMap getMetadataMap() throws SE @JsonIgnore @Override public boolean isNotExpandable() { - return ComplexListInterface - .isNotExpandable(this.getClass()); + return ComplexListInterface.isNotExpandable(this.getClass()); } /** @@ -192,10 +190,16 @@ public PhysicalDataObject(DataObjectPackage dataObjectPackage, String xmlData) t * not respected * @throws InterruptedException if export process is interrupted */ - public static PhysicalDataObject fromSedaXml(SEDAXMLEventReader xmlReader, DataObjectPackage dataObjectPackage, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException, InterruptedException { + public static PhysicalDataObject fromSedaXml( + SEDAXMLEventReader xmlReader, + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException, InterruptedException { PhysicalDataObject pdo = new PhysicalDataObject(); - return (importUnitaryDataObjectPackageIdElementFromSedaXml(pdo, xmlReader, dataObjectPackage, sedaLibProgressLogger) - ? pdo : null); + return ( + importUnitaryDataObjectPackageIdElementFromSedaXml(pdo, xmlReader, dataObjectPackage, sedaLibProgressLogger) + ? pdo + : null + ); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java index a883c74d..a4fd452f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageDeserializer.java @@ -79,8 +79,7 @@ public DataObjectPackageDeserializer(Class t) { * @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext) */ @Override - public DataObjectPackage deserialize(JsonParser parser, DeserializationContext deserializer) - throws IOException { + public DataObjectPackage deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { DataObjectPackage dataObjectPackage = new DataObjectPackage(); parser.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); @@ -93,10 +92,12 @@ public DataObjectPackage deserialize(JsonParser parser, DeserializationContext d while (parser.nextToken() != JsonToken.END_ARRAY) { DataObjectGroup og = parser.readValueAs(DataObjectGroup.class); dataObjectPackage.addDataObjectGroup(og); - for (BinaryDataObject bdo : og.getBinaryDataObjectList()) - dataObjectPackage.addDataObjectPackageIdElement(bdo); - for (PhysicalDataObject pdo : og.getPhysicalDataObjectList()) - dataObjectPackage.addDataObjectPackageIdElement(pdo); + for (BinaryDataObject bdo : og.getBinaryDataObjectList()) dataObjectPackage.addDataObjectPackageIdElement( + bdo + ); + for (PhysicalDataObject pdo : og.getPhysicalDataObjectList()) dataObjectPackage.addDataObjectPackageIdElement( + pdo + ); } break; case "ArchiveUnitList": @@ -114,11 +115,13 @@ public DataObjectPackage deserialize(JsonParser parser, DeserializationContext d dataObjectPackage.setVitamNormalizationStatus(status); break; default: - // ignore other fields + // ignore other fields } } } catch (SEDALibException e) { - throw new SEDALibJsonProcessingException("Erreur dans la deserialisation de l'ArchiveTransfer\n->" + e.getMessage()); + throw new SEDALibJsonProcessingException( + "Erreur dans la deserialisation de l'ArchiveTransfer\n->" + e.getMessage() + ); } return dataObjectPackage; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java index 4b339fc1..9bb80578 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/DataObjectPackageSerializer.java @@ -78,8 +78,11 @@ public DataObjectPackageSerializer(Class t) { * @see com.fasterxml.jackson.databind.ser.std.StdSerializer#serialize(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider) */ @Override - public void serialize(DataObjectPackage dataObjectPackage, JsonGenerator jGen, SerializerProvider serializerProvider) - throws IOException { + public void serialize( + DataObjectPackage dataObjectPackage, + JsonGenerator jGen, + SerializerProvider serializerProvider + ) throws IOException { { String[] tempArray; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java index 15dc0d58..9c454bf5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/json/package-info.java @@ -38,4 +38,4 @@ /** * Package for Jackson json de/serializer of special objects */ -package fr.gouv.vitam.tools.sedalib.core.json; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.core.json; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java index 7a7d7309..d47d693d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/package-info.java @@ -39,4 +39,4 @@ * Package for SEDA structures management and serialization, deserilization to * json and to XML */ -package fr.gouv.vitam.tools.sedalib.core; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.core; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java index 64156cd6..2a35ede5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaContext.java @@ -38,6 +38,7 @@ package fr.gouv.vitam.tools.sedalib.core.seda; public class SedaContext { + private static SedaVersion _version; public static SedaVersion getVersion() { diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java index 37b2372d..c082af76 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverter.java @@ -79,8 +79,13 @@ public DataObjectPackage convert( throw new SEDALibException("Source and target SEDA versions are identical: " + sourceSedaVersion); } if (!sourceSedaVersion.equals(SedaContext.getVersion())) { - throw new SEDALibException("Source and context SEDA versions are different: " + - "(source: " + sourceSedaVersion + ", context: " + SedaContext.getVersion()); + throw new SEDALibException( + "Source and context SEDA versions are different: " + + "(source: " + + sourceSedaVersion + + ", context: " + + SedaContext.getVersion() + ); } logGlobal("Conversion from " + sourceSedaVersion + " to " + targetSedaVersion); @@ -100,31 +105,31 @@ public DataObjectPackage convert( private String serializeToSedaXml(DataObjectPackage dataObjectPackage, SedaVersion sedaVersion) throws SEDALibException, InterruptedException { - logStep("-> Serializing DataObjectPackage to " + sedaVersion.displayString() + " XML"); - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT)) { - + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, IndentXMLTool.STANDARD_INDENT) + ) { dataObjectPackage.toSedaXml(xmlWriter, true, progressLogger); return baos.toString(StandardCharsets.UTF_8); - } catch (IOException | XMLStreamException e) { - throw new SEDALibException("Failed to serialize DataObjectPackage to " + sedaVersion.displayString() + " XML", e); + throw new SEDALibException( + "Failed to serialize DataObjectPackage to " + sedaVersion.displayString() + " XML", + e + ); } } - private DataObjectPackage deserializeFromSedaXml(String xml) - throws SEDALibException, InterruptedException { - + private DataObjectPackage deserializeFromSedaXml(String xml) throws SEDALibException, InterruptedException { logStep("-> Deserializing XML to DataObjectPackage"); - try (ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { - + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { xmlReader.xmlReader.nextEvent(); // skip StartDocument return DataObjectPackage.fromSedaXml(xmlReader, "unknown", progressLogger); - } catch (IOException | XMLStreamException e) { throw new SEDALibException("Failed to deserialize XML to DataObjectPackage", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java index a0146e5a..d2dbb722 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/ContainerDroidIdentifier.java @@ -79,8 +79,11 @@ public class ContainerDroidIdentifier { * @param binarySignatureFile the binary signature file from a " DROID_SignatureFile_Vxxx.xml" * @param containerType the container type ("OLE2", "ZIP"...) */ - public ContainerDroidIdentifier(final ContainerSignatureDefinitions defs, final FFSignatureFile binarySignatureFile, - final String containerType) { + public ContainerDroidIdentifier( + final ContainerSignatureDefinitions defs, + final FFSignatureFile binarySignatureFile, + final String containerType + ) { containerIdentifierInit = new ContainerIdentifierInit(); containerIdentifierInit.init(defs, containerType, formats, null); this.binarySignatureFile = binarySignatureFile; @@ -96,16 +99,19 @@ public ContainerDroidIdentifier(final ContainerSignatureDefinitions defs, final * @return the identification results list completed, if a new format have been identified, or the original list * @throws IOException Signals that an I/O exception has occurred. */ - public IdentificationResultCollection getContainerIdentification(final InputStream inputStream, - final IdentificationResultCollection identificationResults) throws IOException { - - try (IdentificationRequest request = new ContainerFileIdentificationRequest(null)){ + public IdentificationResultCollection getContainerIdentification( + final InputStream inputStream, + final IdentificationResultCollection identificationResults + ) throws IOException { + try (IdentificationRequest request = new ContainerFileIdentificationRequest(null)) { request.open(inputStream); int maxBytesToScan = -1; ContainerSignatureMatchCollection matches = new ContainerSignatureMatchCollection( - getContainerIdentifierInit().getContainerSignatures(), - getContainerIdentifierInit().getUniqueFileEntries(), maxBytesToScan); + getContainerIdentifierInit().getContainerSignatures(), + getContainerIdentifierInit().getUniqueFileEntries(), + maxBytesToScan + ); identifierEngine.process(request, matches); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java index cd1ffa2f..c3093795 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/DroidIdentifier.java @@ -126,7 +126,8 @@ private DroidIdentifier(SEDALibProgressLogger sedaLibProgressLogger, String conf * @return single instance of DroidIdentifier * @throws SEDALibException if the identifier can't be initialised, may be due to wrong signatures files */ - public static DroidIdentifier init(SEDALibProgressLogger sedaLibProgressLogger, String configDir) throws SEDALibException { + public static DroidIdentifier init(SEDALibProgressLogger sedaLibProgressLogger, String configDir) + throws SEDALibException { instance = new DroidIdentifier(sedaLibProgressLogger, configDir); return instance; } @@ -137,13 +138,12 @@ public static DroidIdentifier init(SEDALibProgressLogger sedaLibProgressLogger, * @return single instance of DroidIdentifier */ public static DroidIdentifier getInstance() { - if (instance == null) - try { - instance = new DroidIdentifier(null, "./config"); - } catch (SEDALibException e) { - System.err.println(getAllJavaStackString(e)); - System.exit(1); - } + if (instance == null) try { + instance = new DroidIdentifier(null, "./config"); + } catch (SEDALibException e) { + System.err.println(getAllJavaStackString(e)); + System.exit(1); + } return instance; } @@ -175,20 +175,22 @@ private String getBinarySignatureFileName(SEDALibProgressLogger sedaLibProgressL }; File dir = new File(configDir); - if (dir.isFile()) - throw new SEDALibException("Panic! Can't create config directory"); - else if (!dir.exists()) - //noinspection ResultOfMethodCallIgnored - dir.mkdirs(); + if (dir.isFile()) throw new SEDALibException("Panic! Can't create config directory"); + else if (!dir.exists()) dir.mkdirs(); //noinspection ResultOfMethodCallIgnored String[] fileList = dir.list(droidFilter); if ((fileList == null) || (fileList.length == 0)) { - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, "sedalib: can't find a DROID signature file, copy from ressource to file " + DROID_SIGNATURE_FILE, - null); - try (InputStream is = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(DROID_SIGNATURE_FILE)) { - File targetFile = new File( - "." + File.separator + "config" + File.separator + DROID_SIGNATURE_FILE); + null + ); + try ( + InputStream is = Thread.currentThread() + .getContextClassLoader() + .getResourceAsStream(DROID_SIGNATURE_FILE) + ) { + File targetFile = new File("." + File.separator + "config" + File.separator + DROID_SIGNATURE_FILE); Files.copy(is, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new SEDALibException("Panic! Can't extract a DROID signature file, stop"); @@ -253,20 +255,23 @@ private String getContainerSignatureFileName(SEDALibProgressLogger sedaLibProgre }; File dir = new File(configDir); - if (dir.isFile()) - throw new SEDALibException("Panic! Can't create config directory"); - else if (!dir.exists()) - //noinspection ResultOfMethodCallIgnored - dir.mkdirs(); + if (dir.isFile()) throw new SEDALibException("Panic! Can't create config directory"); + else if (!dir.exists()) dir.mkdirs(); //noinspection ResultOfMethodCallIgnored String[] fileList = dir.list(droidFilter); if ((fileList == null) || (fileList.length == 0)) { - doProgressLogWithoutInterruption(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, "sedalib: can't find a DROID container signature file, copy from ressource to file " + - CONTAINER_SIGNATURE_FILE, null); - try (InputStream is = Thread.currentThread().getContextClassLoader() - .getResourceAsStream(CONTAINER_SIGNATURE_FILE)) { - File targetFile = new File( - "." + File.separator + "config" + File.separator + CONTAINER_SIGNATURE_FILE); + CONTAINER_SIGNATURE_FILE, + null + ); + try ( + InputStream is = Thread.currentThread() + .getContextClassLoader() + .getResourceAsStream(CONTAINER_SIGNATURE_FILE) + ) { + File targetFile = new File("." + File.separator + "config" + File.separator + CONTAINER_SIGNATURE_FILE); Files.copy(is, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new SEDALibException("Panic! Can't extract a DROID signature file, stop"); @@ -304,17 +309,20 @@ private void initContainerDroid(SEDALibProgressLogger sedaLibProgressLogger) thr ContainerSignatureSaxParser parser = new ContainerSignatureSaxParser(); containerSignatureDefinitions = parser.parse(in); } catch (SignatureParseException e) { - throw new SEDALibException("Panic! Can't parse container signature file",e); + throw new SEDALibException("Panic! Can't parse container signature file", e); } catch (Exception e) { - throw new SEDALibException("Panic! Can't open container signature file",e); + throw new SEDALibException("Panic! Can't open container signature file", e); } containerContentIdentierMap = new HashMap<>(); // create container content identifier for OLE2 IdentificationRequestFactory ole2RequestFactory = new ContainerFileIdentificationRequestFactory(); - ContainerDroidIdentifier ole2Identifier = new ContainerDroidIdentifier(containerSignatureDefinitions, - binarySignatureFile, OLE2_CONTAINER); + ContainerDroidIdentifier ole2Identifier = new ContainerDroidIdentifier( + containerSignatureDefinitions, + binarySignatureFile, + OLE2_CONTAINER + ); Ole2IdentifierEngine ole2IdentifierEngine = new Ole2IdentifierEngine(); ole2IdentifierEngine.setRequestFactory(ole2RequestFactory); ole2Identifier.setIdentifierEngine(ole2IdentifierEngine); @@ -322,13 +330,15 @@ private void initContainerDroid(SEDALibProgressLogger sedaLibProgressLogger) thr // create container content identifier for ZIP IdentificationRequestFactory zipRequestFactory = new ContainerFileIdentificationRequestFactory(); - ContainerDroidIdentifier zipIdentifier = new ContainerDroidIdentifier(containerSignatureDefinitions, - binarySignatureFile, ZIP_CONTAINER); + ContainerDroidIdentifier zipIdentifier = new ContainerDroidIdentifier( + containerSignatureDefinitions, + binarySignatureFile, + ZIP_CONTAINER + ); ZipIdentifierEngine zipIdentifierEngine = new ZipIdentifierEngine(); zipIdentifierEngine.setRequestFactory(zipRequestFactory); zipIdentifier.setIdentifierEngine(zipIdentifierEngine); containerContentIdentierMap.put(ZIP_CONTAINER, zipIdentifier); - } /** @@ -340,7 +350,7 @@ private void initContainerDroid(SEDALibProgressLogger sedaLibProgressLogger) thr * @param puid the puid * @return the TriggerPuid by puid */ -// get the container ID for the given PUID if any + // get the container ID for the given PUID if any public TriggerPuid getTriggerPuidByPuid(final String puid) { for (final TriggerPuid tp : containerSignatureDefinitions.getTiggerPuids()) { if (tp.getPuid().equals(puid)) { @@ -369,7 +379,7 @@ public boolean canAnalyzeContainer() { public IdentificationResult getIdentificationResult(Path path) throws SEDALibException { List irl; String filename = path.normalize().toString(); - FileSystemIdentificationRequest request=null; + FileSystemIdentificationRequest request = null; RequestMetaData metaData; try { @@ -379,12 +389,11 @@ public IdentificationResult getIdentificationResult(Path path) throws SEDALibExc request = new FileSystemIdentificationRequest(metaData, identifier); request.open(path); } catch (IOException e) { - if (request!=null) - try { - request.close(); - } catch (IOException e1) { - //ignored - } + if (request != null) try { + request.close(); + } catch (IOException e1) { + //ignored + } throw new SEDALibException("Impossible d'accéder au fichier [" + filename + "]"); } @@ -398,7 +407,7 @@ public IdentificationResult getIdentificationResult(Path path) throws SEDALibExc } catch (IOException e1) { //ignored } - throw new SEDALibException("Erreur dans l'identification par container du fichier [" + filename + "]"); + throw new SEDALibException("Erreur dans l'identification par container du fichier [" + filename + "]"); } if ((resultsContainerCollection != null) && !resultsContainerCollection.getResults().isEmpty()) { @@ -412,16 +421,16 @@ public IdentificationResult getIdentificationResult(Path path) throws SEDALibExc try { request.close(); } catch (IOException e) { - throw new SEDALibException("Erreur dans l'identification droid du fichier [" + filename + "], impossible de fermer la requête"); + throw new SEDALibException( + "Erreur dans l'identification droid du fichier [" + filename + "], impossible de fermer la requête" + ); } if ((irl != null) && (!irl.isEmpty())) { String fileExtension = ""; - if (filename.lastIndexOf('.') != -1) - fileExtension = filename.substring(filename.lastIndexOf('.') + 1); + if (filename.lastIndexOf('.') != -1) fileExtension = filename.substring(filename.lastIndexOf('.') + 1); return selectBestResult(irl, fileExtension); - } else - return null; + } else return null; } /** @@ -431,8 +440,8 @@ public IdentificationResult getIdentificationResult(Path path) throws SEDALibExc * @return the signature results */ IdentificationResultCollection getSignatureResults( - @SuppressWarnings("rawtypes") final IdentificationRequest request) { - + @SuppressWarnings("rawtypes") final IdentificationRequest request + ) { IdentificationResultCollection results = binarySignatureIdentifier.matchBinarySignatures(request); binarySignatureIdentifier.checkForExtensionsMismatches(results, request.getExtension()); return results; @@ -445,8 +454,8 @@ IdentificationResultCollection getSignatureResults( * @return the extension results */ IdentificationResultCollection getExtensionResults( - @SuppressWarnings("rawtypes") final IdentificationRequest request) { - + @SuppressWarnings("rawtypes") final IdentificationRequest request + ) { return binarySignatureIdentifier.matchExtensions(request, true); } @@ -458,8 +467,10 @@ IdentificationResultCollection getExtensionResults( * @return the container results * @throws SEDALibException the SEDALibException */ - IdentificationResultCollection getContainerResults(final IdentificationResultCollection signatureResults, - @SuppressWarnings("rawtypes") final IdentificationRequest request) throws SEDALibException { + IdentificationResultCollection getContainerResults( + final IdentificationResultCollection signatureResults, + @SuppressWarnings("rawtypes") final IdentificationRequest request + ) throws SEDALibException { IdentificationResultCollection containerResults = new IdentificationResultCollection(request); if (!signatureResults.getResults().isEmpty() && canAnalyzeContainer()) { @@ -468,17 +479,21 @@ IdentificationResultCollection getContainerResults(final IdentificationResultCol if (filePuid != null) { TriggerPuid containerPuid = getTriggerPuidByPuid(filePuid); if (containerPuid != null) { - String containerType = containerPuid.getContainerType(); ContainerDroidIdentifier cci = containerContentIdentierMap.get(containerType); if (cci != null) { try { - containerResults = cci.getContainerIdentification(request.getSourceInputStream(), - containerResults); + containerResults = cci.getContainerIdentification( + request.getSourceInputStream(), + containerResults + ); } catch (IOException e) { // go on after problems throw new SEDALibException( - "Impossible d'analyser en conteneur le format du fichier [" + request.getFileName() + "]"); + "Impossible d'analyser en conteneur le format du fichier [" + + request.getFileName() + + "]" + ); } } } @@ -499,12 +514,11 @@ IdentificationResultCollection getContainerResults(final IdentificationResultCol * @param fileExtension the file extension of original file * @return the best identification result, or null if the list was empty */ -// use the signature file priorities and the extension to select the best format + // use the signature file priorities and the extension to select the best format protected IdentificationResult selectBestResult(List irl, String fileExtension) { // special quick return cases int numResults = irl.size(); - if (numResults == 0) - return null; + if (numResults == 0) return null; else if (numResults == 1) { return irl.get(0); } @@ -538,8 +552,7 @@ else if (numResults == 1) { // different return cases numResults = irl.size(); - if (numResults == 0) - return null; + if (numResults == 0) return null; else if (numResults == 1) { return irl.get(0); } else { @@ -561,8 +574,7 @@ else if (numResults == 1) { * @param filename the file name * @return the best identification result puid, or null if the list was empty */ - public static String getFileDroidFormat(String filename) - throws SEDALibException { + public static String getFileDroidFormat(String filename) throws SEDALibException { Path onDiskPath = null; String droidFormat; @@ -571,8 +583,10 @@ public static String getFileDroidFormat(String filename) IdentificationResult ir = DroidIdentifier.getInstance().getIdentificationResult(onDiskPath); droidFormat = ir.getPuid(); } catch (SEDALibException e) { - throw new SEDALibException("Impossible de faire l'identification de format Droid pour le fichier [" - + onDiskPath + "]", e); + throw new SEDALibException( + "Impossible de faire l'identification de format Droid pour le fichier [" + onDiskPath + "]", + e + ); } return droidFormat; } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java index 0e3eab77..ecbafa0e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/droid/package-info.java @@ -40,4 +40,4 @@ * tool and the PRONOM file format register are maintained by The National * Archives of United Kingdom. */ -package fr.gouv.vitam.tools.sedalib.droid; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.droid; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java index 2c8810df..179ffed2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilder.java @@ -108,23 +108,23 @@ public SIPBuilder(String sipPathString, SEDALibProgressLogger sedaLibProgressLog gm.archivalAgencyOrganizationDescriptiveMetadataXmlData = null; gm.transferringAgencyIdentifier = null; gm.transferringAgencyOrganizationDescriptiveMetadataXmlData = null; - gm.codeListVersionsXmlData = " \n" - + " ReplyCodeListVersion\n" - + " MessageDigestAlgorithmCodeListVersion\n" - + " MimeTypeCodeListVersion\n" - + " EncodingCodeListVersion\n" - + " FileFormatCodeListVersion\n" - + " CompressionAlgorithmCodeListVersion\n" - + " DataObjectVersionCodeListVersion\n" - + " StorageRuleCodeListVersion\n" - + " AppraisalRuleCodeListVersion\n" - + " AccessRuleCodeListVersion\n" - + " DisseminationRuleCodeListVersion\n" - + " ReuseRuleCodeListVersion\n" - + " ClassificationRuleCodeListVersion\n" - + " AuthorizationReasonCodeListVersion\n" - + " RelationshipCodeListVersion\n" - + " "; + gm.codeListVersionsXmlData = " \n" + + " ReplyCodeListVersion\n" + + " MessageDigestAlgorithmCodeListVersion\n" + + " MimeTypeCodeListVersion\n" + + " EncodingCodeListVersion\n" + + " FileFormatCodeListVersion\n" + + " CompressionAlgorithmCodeListVersion\n" + + " DataObjectVersionCodeListVersion\n" + + " StorageRuleCodeListVersion\n" + + " AppraisalRuleCodeListVersion\n" + + " AccessRuleCodeListVersion\n" + + " DisseminationRuleCodeListVersion\n" + + " ReuseRuleCodeListVersion\n" + + " ClassificationRuleCodeListVersion\n" + + " AuthorizationReasonCodeListVersion\n" + + " RelationshipCodeListVersion\n" + + " "; this.archiveTransfer.setGlobalMetadata(gm); this.sedaLibProgressLogger = sedaLibProgressLogger; this.managementMetadata = mm; @@ -165,8 +165,12 @@ public void setMessageIdentifier(String messageIdentifier) { * @param originatingAgencyIdentifier the originating agency identifier * @param submissionAgencyIdentifier the submission agency identifier */ - public void setAgencies(String archivalAgencyIdentifier, String transferringAgencyIdentifier, - String originatingAgencyIdentifier, String submissionAgencyIdentifier) { + public void setAgencies( + String archivalAgencyIdentifier, + String transferringAgencyIdentifier, + String originatingAgencyIdentifier, + String submissionAgencyIdentifier + ) { archiveTransfer.getGlobalMetadata().archivalAgencyIdentifier = archivalAgencyIdentifier; archiveTransfer.getGlobalMetadata().transferringAgencyIdentifier = transferringAgencyIdentifier; try { @@ -201,7 +205,12 @@ public ArchiveUnit createRootArchiveUnit(String archiveUnitID) throws SEDALibExc au.setDataObjectPackage(archiveTransfer.getDataObjectPackage()); archiveTransfer.getDataObjectPackage().addArchiveUnit(au); archiveTransfer.getDataObjectPackage().addRootAu(au); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: création d'une ArchiveUnit racine [" + archiveUnitID + "]", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: création d'une ArchiveUnit racine [" + archiveUnitID + "]", + null + ); return au; } @@ -215,8 +224,12 @@ public ArchiveUnit createRootArchiveUnit(String archiveUnitID) throws SEDALibExc * @return the archive unit * @throws SEDALibException when the ArchiveUnit has a defined UniqId which is already in the SIP */ - public ArchiveUnit createRootArchiveUnit(String archiveUnitID, String descriptionLevel, String title, - String description) throws SEDALibException { + public ArchiveUnit createRootArchiveUnit( + String archiveUnitID, + String descriptionLevel, + String title, + String description + ) throws SEDALibException { ArchiveUnit au = createRootArchiveUnit(archiveUnitID); Content c = new Content(); @@ -242,10 +255,9 @@ public ArchiveUnit createRootArchiveUnit(String archiveUnitID, String descriptio * @throws SEDALibException when the ArchiveUnit has a defined UniqId which is already in the SIP */ public ArchiveUnit createSystemExistingRootArchiveUnit(String archiveUnitID, String systemId) - throws SEDALibException { + throws SEDALibException { ArchiveUnit au = createRootArchiveUnit(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); Management m = new Management(); m.addNewMetadata("UpdateOperation", systemId); @@ -267,8 +279,13 @@ public ArchiveUnit createSystemExistingRootArchiveUnit(String archiveUnitID, Str * @return the archive unit * @throws SEDALibException when the ArchiveUnit has a defined UniqId which is already in the SIP */ - public ArchiveUnit createSystemExistingRootArchiveUnit(String archiveUnitID, String metadataName, - String metadataValue, String descriptionLevel, String title) throws SEDALibException { + public ArchiveUnit createSystemExistingRootArchiveUnit( + String archiveUnitID, + String metadataName, + String metadataValue, + String descriptionLevel, + String title + ) throws SEDALibException { ArchiveUnit au = createRootArchiveUnit(archiveUnitID); Management m = new Management(); @@ -293,12 +310,11 @@ public ArchiveUnit createSystemExistingRootArchiveUnit(String archiveUnitID, Str */ public ArchiveUnit addSubArchiveUnit(String archiveUnitID, String childArchiveUnitID) throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); - ArchiveUnit childAU = archiveTransfer.getDataObjectPackage() - .getArchiveUnitById(childArchiveUnitID); - if (childAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); + ArchiveUnit childAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(childArchiveUnitID); + if (childAU == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); parentAU.addChildArchiveUnit(childAU); return childAU; } @@ -314,11 +330,17 @@ public ArchiveUnit addSubArchiveUnit(String archiveUnitID, String childArchiveUn * @return the archive unit * @throws SEDALibException if no identified ArchiveUnit, or when there is already an ArchiveUnit with the same UniqID */ - public ArchiveUnit addNewSubArchiveUnit(String archiveUnitID, String childArchiveUnitID, String descriptionLevel, - String title, String description) throws SEDALibException { + public ArchiveUnit addNewSubArchiveUnit( + String archiveUnitID, + String childArchiveUnitID, + String descriptionLevel, + String title, + String description + ) throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); ArchiveUnit au; au = new ArchiveUnit(); @@ -330,8 +352,12 @@ public ArchiveUnit addNewSubArchiveUnit(String archiveUnitID, String childArchiv c.addNewMetadata("Description", description); au.setContent(c); parentAU.addChildArchiveUnit(au); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, - "sedalib: création d'une sous ArchiveUnit [" + childArchiveUnitID + "] de [" + archiveUnitID + "]",null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: création d'une sous ArchiveUnit [" + childArchiveUnitID + "] de [" + archiveUnitID + "]", + null + ); return au; } @@ -344,15 +370,18 @@ public ArchiveUnit addNewSubArchiveUnit(String archiveUnitID, String childArchiv */ public void addArchiveUnitSubTree(String archiveUnitID, String fromArchiveUnitID) throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); - ArchiveUnit fromAU = archiveTransfer.getDataObjectPackage() - .getArchiveUnitById(fromArchiveUnitID); - if (fromAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); - for (ArchiveUnit au : fromAU.getChildrenAuList().getArchiveUnitList()) - parentAU.addChildArchiveUnit(au); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", null); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); + ArchiveUnit fromAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(fromArchiveUnitID); + if (fromAU == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + for (ArchiveUnit au : fromAU.getChildrenAuList().getArchiveUnitList()) parentAU.addChildArchiveUnit(au); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", + null + ); } /** @@ -367,11 +396,18 @@ public void addArchiveUnitSubTree(String archiveUnitID, String fromArchiveUnitID * @return the archive unit * @throws SEDALibException if no identified ArchiveUnit, file access problem , or when there is already an ArchiveUnit with the same UniqID */ - public ArchiveUnit addFileSubArchiveUnit(String archiveUnitID, String onDiskPath, String childArchiveUnitID, - String descriptionLevel, String title, String description) throws SEDALibException { + public ArchiveUnit addFileSubArchiveUnit( + String archiveUnitID, + String onDiskPath, + String childArchiveUnitID, + String descriptionLevel, + String title, + String description + ) throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); ArchiveUnit au; BinaryDataObject bdo; @@ -385,12 +421,20 @@ public ArchiveUnit addFileSubArchiveUnit(String archiveUnitID, String onDiskPath au.setContent(c); parentAU.addChildArchiveUnit(au); Path path = Paths.get(onDiskPath); - bdo = new BinaryDataObject(archiveTransfer.getDataObjectPackage(), path, path.getFileName().toString(), - "BinaryMaster_1"); + bdo = new BinaryDataObject( + archiveTransfer.getDataObjectPackage(), + path, + path.getFileName().toString(), + "BinaryMaster_1" + ); bdo.extractTechnicalElements(sedaLibProgressLogger); au.addDataObjectById(bdo.getInDataObjectPackageId()); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, - "sedalib: création d'une sous ArchiveUnit [" + childArchiveUnitID + "] de [" + archiveUnitID + "]", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: création d'une sous ArchiveUnit [" + childArchiveUnitID + "] de [" + archiveUnitID + "]", + null + ); return au; } @@ -403,8 +447,8 @@ public ArchiveUnit addFileSubArchiveUnit(String archiveUnitID, String onDiskPath * @throws SEDALibException if no identified ArchiveUnit */ public void addDiskSubTree(String archiveUnitID, String onDiskPathString, String... ignorePatterString) - throws SEDALibException { - addDiskSubTree(archiveUnitID,onDiskPathString,false,null,ignorePatterString); + throws SEDALibException { + addDiskSubTree(archiveUnitID, onDiskPathString, false, null, ignorePatterString); } /** @@ -423,19 +467,25 @@ public void addDiskSubTree(String archiveUnitID, String onDiskPathString, String * @param ignorePatterString the ignore patter string * @throws SEDALibException if no identified ArchiveUnit */ - public void addDiskSubTree(String archiveUnitID, String onDiskPathString, boolean noLinkFlag, - Function extractTitleFromFileNameFunction, - String... ignorePatterString) - throws SEDALibException { - + public void addDiskSubTree( + String archiveUnitID, + String onDiskPathString, + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + String... ignorePatterString + ) throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); - DiskToDataObjectPackageImporter di = new DiskToDataObjectPackageImporter(onDiskPathString, noLinkFlag, - extractTitleFromFileNameFunction,sedaLibProgressLogger); - - for (String ip : ignorePatterString) - di.addIgnorePattern(ip); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); + DiskToDataObjectPackageImporter di = new DiskToDataObjectPackageImporter( + onDiskPathString, + noLinkFlag, + extractTitleFromFileNameFunction, + sedaLibProgressLogger + ); + + for (String ip : ignorePatterString) di.addIgnorePattern(ip); try { di.doImport(); } catch (InterruptedException ignored) { @@ -443,7 +493,12 @@ public void addDiskSubTree(String archiveUnitID, String onDiskPathString, boolea } parentAU.getDataObjectPackage().moveContentFromDataObjectPackage(di.getDataObjectPackage(), parentAU); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", + null + ); } /** @@ -456,11 +511,17 @@ public void addDiskSubTree(String archiveUnitID, String onDiskPathString, boolea * @throws SEDALibException if no identified ArchiveUnit */ public void addCSVMetadataSubTree(String archiveUnitID, String encoding, char separator, String onDiskPathString) - throws SEDALibException { + throws SEDALibException { ArchiveUnit parentAU = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (parentAU == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); - CSVMetadataToDataObjectPackageImporter cmi = new CSVMetadataToDataObjectPackageImporter(onDiskPathString, encoding, separator, sedaLibProgressLogger); + if (parentAU == null) throw new SEDALibException( + "Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]" + ); + CSVMetadataToDataObjectPackageImporter cmi = new CSVMetadataToDataObjectPackageImporter( + onDiskPathString, + encoding, + separator, + sedaLibProgressLogger + ); try { cmi.doImport(); @@ -469,7 +530,12 @@ public void addCSVMetadataSubTree(String archiveUnitID, String encoding, char se } parentAU.getDataObjectPackage().moveContentFromDataObjectPackage(cmi.getDataObjectPackage(), parentAU); - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: ajout d'un sous-arbre à [" + archiveUnitID + "]", + null + ); } /** @@ -480,14 +546,19 @@ public void addCSVMetadataSubTree(String archiveUnitID, String encoding, char se * @param usageVersion the usageVersion metadata in "usage_version" format * @throws SEDALibException if no identified ArchiveUnit or file acces problem */ - public void addFileToArchiveUnit(String archiveUnitID, String onDiskPathString, String usageVersion) throws SEDALibException { + public void addFileToArchiveUnit(String archiveUnitID, String onDiskPathString, String usageVersion) + throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); Path path = Paths.get(onDiskPathString); String filename = path.getFileName().toString(); - BinaryDataObject bdo = new BinaryDataObject(archiveTransfer.getDataObjectPackage(), path, filename, usageVersion); + BinaryDataObject bdo = new BinaryDataObject( + archiveTransfer.getDataObjectPackage(), + path, + filename, + usageVersion + ); bdo.extractTechnicalElements(sedaLibProgressLogger); au.addDataObjectById(bdo.getInDataObjectPackageId()); } @@ -501,10 +572,10 @@ public void addFileToArchiveUnit(String archiveUnitID, String onDiskPathString, * @return the String formatted metadata value * @throws SEDALibException if no identified ArchiveUnit, XML read exception or inappropriate xml in rawContenteData */ - public String findArchiveUnitSimpleDescriptiveMetadata(String archiveUnitID, String metadataName) throws SEDALibException { + public String findArchiveUnitSimpleDescriptiveMetadata(String archiveUnitID, String metadataName) + throws SEDALibException { Content c = getContent(archiveUnitID); - if (c == null) - return null; + if (c == null) return null; return c.getSimpleMetadata(metadataName); } @@ -517,12 +588,11 @@ public String findArchiveUnitSimpleDescriptiveMetadata(String archiveUnitID, Str * @return the ArchiveUnit or null * @throws SEDALibException if no identified ArchiveUnit */ - public ArchiveUnit findArchiveUnitBySimpleDescriptiveMetadata(String metadataName, String metadataValue) throws SEDALibException { - + public ArchiveUnit findArchiveUnitBySimpleDescriptiveMetadata(String metadataName, String metadataValue) + throws SEDALibException { for (ArchiveUnit au : archiveTransfer.getDataObjectPackage().getAuInDataObjectPackageIdMap().values()) { String auValue = au.getContent().getSimpleMetadata(metadataName); - if ((auValue != null) && (auValue.equals(metadataValue))) - return au; + if ((auValue != null) && (auValue.equals(metadataValue))) return au; } return null; } @@ -536,8 +606,7 @@ public ArchiveUnit findArchiveUnitBySimpleDescriptiveMetadata(String metadataNam */ public ArchiveUnit findArchiveUnit(String archiveUnitID) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); return au; } @@ -550,8 +619,7 @@ public ArchiveUnit findArchiveUnit(String archiveUnitID) throws SEDALibException */ public ArchiveUnitProfile getArchiveUnitProfile(String archiveUnitID) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); ArchiveUnitProfile aup = au.getArchiveUnitProfile(); if (aup == null) { aup = new ArchiveUnitProfile(); @@ -567,10 +635,10 @@ public ArchiveUnitProfile getArchiveUnitProfile(String archiveUnitID) throws SED * @param archiveUnitProfile the ArchiveUnitProfile * @throws SEDALibException if no identified ArchiveUnit */ - public void setArchiveUnitProfile(String archiveUnitID, ArchiveUnitProfile archiveUnitProfile) throws SEDALibException { + public void setArchiveUnitProfile(String archiveUnitID, ArchiveUnitProfile archiveUnitProfile) + throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); au.setArchiveUnitProfile(archiveUnitProfile); } @@ -583,8 +651,7 @@ public void setArchiveUnitProfile(String archiveUnitID, ArchiveUnitProfile archi */ public Content getContent(String archiveUnitID) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); Content c = au.getContent(); if (c == null) { c = new Content(); @@ -602,8 +669,7 @@ public Content getContent(String archiveUnitID) throws SEDALibException { */ public void setContent(String archiveUnitID, Content content) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); au.setContent(content); } @@ -616,8 +682,7 @@ public void setContent(String archiveUnitID, Content content) throws SEDALibExce */ public Management getManagement(String archiveUnitID) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); Management m = au.getManagement(); if (m == null) { m = new Management(); @@ -635,8 +700,7 @@ public Management getManagement(String archiveUnitID) throws SEDALibException { */ public void setManagement(String archiveUnitID, Management management) throws SEDALibException { ArchiveUnit au = archiveTransfer.getDataObjectPackage().getArchiveUnitById(archiveUnitID); - if (au == null) - throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); + if (au == null) throw new SEDALibException("Pas d'ArchiveUnit avec l'identifiant [" + archiveUnitID + "]"); au.setManagement(management); } @@ -649,7 +713,7 @@ public void setManagement(String archiveUnitID, Management management) throws SE * @throws SEDALibException if no identified ArchiveUnit, XML read exception or inappropriate xml in rawContentData */ public void addNewContentMetadataInArchiveUnit(String archiveUnitID, String elementName, Object... args) - throws SEDALibException { + throws SEDALibException { Content c = getContent(archiveUnitID); c.addNewMetadata(elementName, args); setContent(archiveUnitID, c); @@ -664,13 +728,12 @@ public void addNewContentMetadataInArchiveUnit(String archiveUnitID, String elem * @throws SEDALibException if no identified ArchiveUnit, XML read exception or inappropriate xml in rawManagementData */ public void addNewManagementMetadataInArchiveUnit(String archiveUnitID, String elementName, Object... args) - throws SEDALibException { + throws SEDALibException { Management m = getManagement(archiveUnitID); m.addNewMetadata(elementName, args); setManagement(archiveUnitID, m); } - /** * Validate SEDA schema conformity for global SEDA2Version . * @@ -692,7 +755,7 @@ public void sedaSchemaValidate() throws SEDALibException { */ public void sedaProfileValidate(String profileFileName) throws SEDALibException { try { - archiveTransfer.sedaProfileValidate(profileFileName,sedaLibProgressLogger); + archiveTransfer.sedaProfileValidate(profileFileName, sedaLibProgressLogger); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } @@ -704,16 +767,21 @@ public void sedaProfileValidate(String profileFileName) throws SEDALibException * @throws SEDALibException the SEDA lib exception */ private void verifyContext() throws SEDALibException { - if (archiveTransfer.getGlobalMetadata().archivalAgencyIdentifier == null) - throw new SEDALibException("Element ArchivalAgencyIdentifier non défini"); - if (archiveTransfer.getGlobalMetadata().transferringAgencyIdentifier == null) - throw new SEDALibException("Element TransferringAgencyIdentifier non défini"); - if (managementMetadata.isMetadataLacking("OriginatingAgencyIdentifier")) - throw new SEDALibException("Element OriginatingAgencyIdentifier non défini"); - if (managementMetadata.isMetadataLacking("SubmissionAgencyIdentifier")) - throw new SEDALibException("Element SubmissionAgencyIdentifier non défini"); - if (archiveTransfer.getGlobalMetadata().archivalAgreement == null) - throw new SEDALibException("Element ArchivalAgreement non défini"); + if (archiveTransfer.getGlobalMetadata().archivalAgencyIdentifier == null) throw new SEDALibException( + "Element ArchivalAgencyIdentifier non défini" + ); + if (archiveTransfer.getGlobalMetadata().transferringAgencyIdentifier == null) throw new SEDALibException( + "Element TransferringAgencyIdentifier non défini" + ); + if (managementMetadata.isMetadataLacking("OriginatingAgencyIdentifier")) throw new SEDALibException( + "Element OriginatingAgencyIdentifier non défini" + ); + if (managementMetadata.isMetadataLacking("SubmissionAgencyIdentifier")) throw new SEDALibException( + "Element SubmissionAgencyIdentifier non défini" + ); + if (archiveTransfer.getGlobalMetadata().archivalAgreement == null) throw new SEDALibException( + "Element ArchivalAgreement non défini" + ); } /** @@ -733,7 +801,12 @@ public void generateSIP() throws SEDALibException { * @throws SEDALibException the SEDA lib exception */ public void generateSIP(boolean hierarchicalArchiveUnitsFlag, boolean indentedFlag) throws SEDALibException { - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: lancement de la génération du SIP", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: lancement de la génération du SIP", + null + ); try { archiveTransfer.getDataObjectPackage().vitamNormalize(sedaLibProgressLogger); verifyContext(); @@ -751,8 +824,14 @@ public void generateSIP(boolean hierarchicalArchiveUnitsFlag, boolean indentedFl } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - doProgressLogWithoutInterruption(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: fichier sauvegardé (" + SEDALibProgressLogger.readableFileSize(new File(sipPathString).length()) - + ")", null); + doProgressLogWithoutInterruption( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: fichier sauvegardé (" + + SEDALibProgressLogger.readableFileSize(new File(sipPathString).length()) + + ")", + null + ); } /* @@ -764,5 +843,4 @@ public void generateSIP(boolean hierarchicalArchiveUnitsFlag, boolean indentedFl public void close() { // mandatory for closable, can be used for extension } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java index a7e53ae8..e1a32755 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToDiskExporter.java @@ -109,8 +109,10 @@ public class ArchiveTransferToDiskExporter { public ArchiveTransferToDiskExporter(ArchiveTransfer archiveTransfer, SEDALibProgressLogger sedaLibProgressLogger) { this.sedaLibProgressLogger = sedaLibProgressLogger; this.archiveTransfer = archiveTransfer; - dataObjectPackageToDiskExporter = new DataObjectPackageToDiskExporter(archiveTransfer.getDataObjectPackage(), - sedaLibProgressLogger); + dataObjectPackageToDiskExporter = new DataObjectPackageToDiskExporter( + archiveTransfer.getDataObjectPackage(), + sedaLibProgressLogger + ); } /** @@ -121,16 +123,19 @@ public ArchiveTransferToDiskExporter(ArchiveTransfer archiveTransfer, SEDALibPro * @throws SEDALibException if writing has failed */ public void exportArchiveTransferGlobalMetadata(GlobalMetadata globalMetadata, Path containerPath) - throws SEDALibException { + throws SEDALibException { Path targetOnDiskPath; // write binary file targetOnDiskPath = containerPath.resolve("__GlobalMetadata.xml"); - try (FileOutputStream fos = new FileOutputStream(targetOnDiskPath.toFile()); - Writer rawWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) { + try ( + FileOutputStream fos = new FileOutputStream(targetOnDiskPath.toFile()); + Writer rawWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8) + ) { rawWriter.write(globalMetadata.toSedaXmlFragments()); } catch (Exception e) { throw new SEDALibException( - "Ecriture des métadonnées globales [" + targetOnDiskPath + "] impossible\n->" + e.getMessage()); + "Ecriture des métadonnées globales [" + targetOnDiskPath + "] impossible\n->" + e.getMessage() + ); } } @@ -156,21 +161,29 @@ public void doExport(String directoryName) throws SEDALibException, InterruptedE String log = "Début de l'export d'un ArchiveTransfer dans une hiérarchie sur disque\n"; log += "en [" + directoryName + "]"; log += " date=" + DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); exportPath = Paths.get(directoryName); try { Files.createDirectories(exportPath); } catch (Exception e) { throw new SEDALibException( - "Création du répertoire d'export [" + exportPath + "] impossible\n->" + e.getMessage()); + "Création du répertoire d'export [" + exportPath + "] impossible\n->" + e.getMessage() + ); } - if (archiveTransfer.getGlobalMetadata() != null) - exportArchiveTransferGlobalMetadata(archiveTransfer.getGlobalMetadata(), exportPath); + if (archiveTransfer.getGlobalMetadata() != null) exportArchiveTransferGlobalMetadata( + archiveTransfer.getGlobalMetadata(), + exportPath + ); dataObjectPackageToDiskExporter.doExport(directoryName); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: export d'un ArchiveTransfer dans une hiérarchie sur disque terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: export d'un ArchiveTransfer dans une hiérarchie sur disque terminé", + null + ); end = Instant.now(); } @@ -183,8 +196,8 @@ public String getSummary() { String result = "Export d'un ArchiveTransfer dans une hiérarchie sur disque\n"; result += "en [" + exportPath + "]\n"; result += "encodé selon un modèle V2 de la structure\n"; - if ((start != null) && (end != null)) - result += "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; + if ((start != null) && (end != null)) result += + "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java index 3f3f8baa..cb70695f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/ArchiveTransferToSIPExporter.java @@ -112,8 +112,10 @@ public ArchiveTransferToSIPExporter(ArchiveTransfer archiveTransfer, SEDALibProg * @throws InterruptedException if export process is interrupted */ public void exportManifestOutputStream(OutputStream os, boolean hierarchicalFlag, boolean indentedFlag) - throws SEDALibException, InterruptedException { - try (SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(os, (indentedFlag ? IndentXMLTool.STANDARD_INDENT : 0))) { + throws SEDALibException, InterruptedException { + try ( + SEDAXMLStreamWriter ixsw = new SEDAXMLStreamWriter(os, (indentedFlag ? IndentXMLTool.STANDARD_INDENT : 0)) + ) { xmlWriter = ixsw; archiveTransfer.toSedaXml(xmlWriter, hierarchicalFlag, sedaLibProgressLogger); } catch (XMLStreamException e) { @@ -131,13 +133,13 @@ public void exportManifestOutputStream(OutputStream os, boolean hierarchicalFlag * @throws InterruptedException if export process is interrupted */ public void doExportToSEDAXMLManifest(String fileName, boolean hierarchicalFlag, boolean indentedFlag) - throws SEDALibException, InterruptedException { + throws SEDALibException, InterruptedException { Date d = new Date(); start = Instant.now(); String log = "sedalib: début de l'export d'un ArchiveTransfer dans un manifest SEDA\n"; log += "en [" + fileName + "] date="; log += DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); this.exportPath = Paths.get(fileName); this.hierarchicalFlag = hierarchicalFlag; @@ -150,7 +152,7 @@ public void doExportToSEDAXMLManifest(String fileName, boolean hierarchicalFlag, throw new SEDALibException("Echec de l'export du manifest dans le fichier [" + fileName + "]", e); } - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: export terminé", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: export terminé", null); end = Instant.now(); } @@ -164,14 +166,14 @@ public void doExportToSEDAXMLManifest(String fileName, boolean hierarchicalFlag, * @throws InterruptedException if export process is interrupted */ public String getSEDAXMLManifest(boolean hierarchicalFlag, boolean indentedFlag) - throws SEDALibException, InterruptedException { + throws SEDALibException, InterruptedException { String result; Date d = new Date(); start = Instant.now(); String log = "sedalib: début de l'export d'un ArchiveTransfer dans un manifest SEDA\n"; log += "en chaîne de caractères interne date="; log += DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); this.hierarchicalFlag = hierarchicalFlag; this.indentedFlag = indentedFlag; @@ -179,12 +181,12 @@ public String getSEDAXMLManifest(boolean hierarchicalFlag, boolean indentedFlag) try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { exportManifestOutputStream(baos, hierarchicalFlag, indentedFlag); - result=baos.toString("UTF8"); + result = baos.toString("UTF8"); } catch (SEDALibException | IOException e) { throw new SEDALibException("Echec de l'export du manifest", e); } - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: export terminé", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: export terminé", null); end = Instant.now(); return result; } @@ -199,14 +201,14 @@ public String getSEDAXMLManifest(boolean hierarchicalFlag, boolean indentedFlag) * @throws InterruptedException if export process is interrupted */ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean indentedFlag) - throws SEDALibException, InterruptedException { + throws SEDALibException, InterruptedException { int counter = 0; Date d = new Date(); start = Instant.now(); String log = "sedalib: début de l'export d'un ArchiveTransfer dans un SIP\n"; log += "en [" + fileName + "] date="; log += DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); this.exportPath = Paths.get(fileName); this.hierarchicalFlag = hierarchicalFlag; @@ -216,7 +218,12 @@ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean try { Files.createDirectories(Paths.get(fileName).toAbsolutePath().getParent()); } catch (IOException e1) { - throw new SEDALibException("Impossible de créer le répertoire [" + Paths.get(fileName).toAbsolutePath().getParent().toString() + "]", e1); + throw new SEDALibException( + "Impossible de créer le répertoire [" + + Paths.get(fileName).toAbsolutePath().getParent().toString() + + "]", + e1 + ); } try (ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream(fileName))) { ZipEntry e = new ZipEntry("manifest.xml"); @@ -224,11 +231,13 @@ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean zipout.putNextEntry(e); exportManifestOutputStream(zipout, hierarchicalFlag, indentedFlag); zipout.closeEntry(); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: manifest exporté", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: manifest exporté", null); // all binary objects if (archiveTransfer.getDataObjectPackage().getDataObjectGroupCount() > 0) { - for (Map.Entry pair : archiveTransfer.getDataObjectPackage() - .getDogInDataObjectPackageIdMap().entrySet()) { + for (Map.Entry pair : archiveTransfer + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .entrySet()) { DataObjectGroup og = pair.getValue(); if (og.getBinaryDataObjectList() != null) { for (BinaryDataObject bo : og.getBinaryDataObjectList()) { @@ -239,8 +248,12 @@ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean } zipout.closeEntry(); counter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " fichiers BinaryDataObject exportés"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " fichiers BinaryDataObject exportés" + ); } } } @@ -249,7 +262,12 @@ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean throw new SEDALibException("Echec de l'export du SIP dans le fichier [" + fileName + "]", e); } - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: export d'un ArchiveTransfer dans un SIP terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: export d'un ArchiveTransfer dans un SIP terminé", + null + ); end = Instant.now(); } @@ -260,22 +278,16 @@ public void doExportToSEDASIP(String fileName, boolean hierarchicalFlag, boolean */ public String getSummary() { String result = "Export d'un ArchiveTransfer dans un "; - if (manifestOnly) - result += "manifest SEDA\n"; - else - result += "SIP\n"; + if (manifestOnly) result += "manifest SEDA\n"; + else result += "SIP\n"; result += "en [" + exportPath + "]\n"; - if (hierarchicalFlag) - result += "avec une structure imbriquée "; - else - result += "avec une structure à plat "; - if (indentedFlag) - result += "en XML identé\n"; - else - result += "en XML continu\n"; + if (hierarchicalFlag) result += "avec une structure imbriquée "; + else result += "avec une structure à plat "; + if (indentedFlag) result += "en XML identé\n"; + else result += "en XML continu\n"; - if ((start != null) && (end != null)) - result += "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; + if ((start != null) && (end != null)) result += + "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java index 581ec31d..d0baa7a5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToCSVMetadataExporter.java @@ -102,6 +102,7 @@ * and finally attributes to put in <Description> if any. Many values of a tag can be defined in csv, for example 2 Writers, so it's written as Writer.0 and Writer.1, and FullName is Writer.0.FullName. */ public class DataObjectPackageToCSVMetadataExporter { + /** * The data object package. */ @@ -196,7 +197,15 @@ public class DataObjectPackageToCSVMetadataExporter { * @param maxNameSize the max name size * @param sedaLibProgressLogger the progress logger or null if no progress log expected */ - public DataObjectPackageToCSVMetadataExporter(DataObjectPackage dataObjectPackage, String encoding, char separator, int usageVersionSelectionMode, boolean extendedFormatFlag, int maxNameSize, SEDALibProgressLogger sedaLibProgressLogger) { + public DataObjectPackageToCSVMetadataExporter( + DataObjectPackage dataObjectPackage, + String encoding, + char separator, + int usageVersionSelectionMode, + boolean extendedFormatFlag, + int maxNameSize, + SEDALibProgressLogger sedaLibProgressLogger + ) { this.sedaLibProgressLogger = sedaLibProgressLogger; this.dataObjectPackage = dataObjectPackage; this.encoding = encoding; @@ -211,8 +220,7 @@ public DataObjectPackageToCSVMetadataExporter(DataObjectPackage dataObjectPackag // 0 is for metadata present but without number derivation // -1 is for not present metadata private int getMaxRank(Set headerNames, String name) { - if (headerNames.contains(name)) - return 0; + if (headerNames.contains(name)) return 0; int pos = name.split("\\.").length; int maxRank = -1; for (String tmp : headerNames) { @@ -231,51 +239,65 @@ private int getMaxRank(Set headerNames, String name) { return maxRank; } - // extract and sort headernames for RuleType metadata private List getRuleTypeHeaderNames(Set headerNames, String ruleName) { List ruleHeaderNames = new ArrayList<>(); int rank = 0; while (headerNames.contains(ruleName + ".Rule." + rank)) { ruleHeaderNames.add(ruleName + ".Rule." + rank); - List ruleMetadataKindList = - Arrays.asList("StartDate","HoldEndDate", "HoldOwner", "HoldReassessingDate", "HoldReason", "PreventRearrangement"); + List ruleMetadataKindList = Arrays.asList( + "StartDate", + "HoldEndDate", + "HoldOwner", + "HoldReassessingDate", + "HoldReason", + "PreventRearrangement" + ); for (String ruleHeaderName : ruleMetadataKindList) { - if (headerNames.contains(ruleName + "." + ruleHeaderName + "." + rank)) - ruleHeaderNames.add(ruleName + "." + ruleHeaderName + "." + rank); + if (headerNames.contains(ruleName + "." + ruleHeaderName + "." + rank)) ruleHeaderNames.add( + ruleName + "." + ruleHeaderName + "." + rank + ); } rank++; } - if (headerNames.contains(ruleName + ".PreventInheritance")) - ruleHeaderNames.add(ruleName + ".PreventInheritance"); - if (headerNames.contains(ruleName + ".ClassificationLevel")) - ruleHeaderNames.add(ruleName + ".ClassificationLevel"); - if (headerNames.contains(ruleName + ".ClassificationOwner")) - ruleHeaderNames.add(ruleName + ".ClassificationOwner"); - if (headerNames.contains(ruleName + ".ClassificationReassessingDate")) - ruleHeaderNames.add(ruleName + ".ClassificationReassessingDate"); - if (headerNames.contains(ruleName + ".NeedReassessingAuthorization")) - ruleHeaderNames.add(ruleName + ".NeedReassessingAuthorization"); + if (headerNames.contains(ruleName + ".PreventInheritance")) ruleHeaderNames.add( + ruleName + ".PreventInheritance" + ); + if (headerNames.contains(ruleName + ".ClassificationLevel")) ruleHeaderNames.add( + ruleName + ".ClassificationLevel" + ); + if (headerNames.contains(ruleName + ".ClassificationOwner")) ruleHeaderNames.add( + ruleName + ".ClassificationOwner" + ); + if (headerNames.contains(ruleName + ".ClassificationReassessingDate")) ruleHeaderNames.add( + ruleName + ".ClassificationReassessingDate" + ); + if (headerNames.contains(ruleName + ".NeedReassessingAuthorization")) ruleHeaderNames.add( + ruleName + ".NeedReassessingAuthorization" + ); rank = 0; while (headerNames.contains(ruleName + ".RefNonRuleId." + rank)) { ruleHeaderNames.add(ruleName + ".RefNonRuleId." + rank); rank++; } - if (headerNames.contains(ruleName + ".FinalAction")) - ruleHeaderNames.add(ruleName + ".FinalAction"); + if (headerNames.contains(ruleName + ".FinalAction")) ruleHeaderNames.add(ruleName + ".FinalAction"); return ruleHeaderNames; } // extract and sort headernames by there defined order in composed types - private List getSortedHeaderNames(List sortedHeaderNames, Set headerNames, - String prefixHeaderName, String xmlElementName, Class metadataClass) throws SEDALibException { + private List getSortedHeaderNames( + List sortedHeaderNames, + Set headerNames, + String prefixHeaderName, + String xmlElementName, + Class metadataClass + ) throws SEDALibException { String currentName = prefixHeaderName + (prefixHeaderName.isEmpty() ? "" : ".") + xmlElementName; String infix; int maxRank = getMaxRank(headerNames, currentName); if (maxRank != -1) { { - if (maxRank == 0) - infix = ""; + if (maxRank == 0) infix = ""; else infix = ".0"; int i = 0; do { @@ -286,15 +308,21 @@ private List getSortedHeaderNames(List sortedHeaderNames, Set e : ComplexListType.getMetadataMap(metadataClass).entrySet()) { - getSortedHeaderNames(sortedHeaderNames, headerNames, currentName + infix, - e.getKey(), e.getValue().getMetadataClass()); + for (Map.Entry e : ComplexListType.getMetadataMap( + metadataClass + ).entrySet()) { + getSortedHeaderNames( + sortedHeaderNames, + headerNames, + currentName + infix, + e.getKey(), + e.getValue().getMetadataClass() + ); } // add extensions if any TreeSet extensions = new TreeSet<>(); for (String header : headerNames) { - if (header.startsWith(currentName + ".")) - extensions.add(header); + if (header.startsWith(currentName + ".")) extensions.add(header); } headerNames.removeAll(extensions); sortedHeaderNames.addAll(extensions); @@ -323,14 +351,13 @@ private void computeCsvHeader() throws SEDALibException { List sortedHeaderNames; for (ArchiveUnit au : dataObjectPackage.getAuInDataObjectPackageIdMap().values()) { Management management = au.getManagement(); - if (management != null) - curHeaderNames.addAll(management.externToCsvList().keySet()); + if (management != null) curHeaderNames.addAll(management.externToCsvList().keySet()); curHeaderNames.addAll(au.getContent().externToCsvList(dataObjectPackage.getExportMetadataList()).keySet()); } - sortedHeaderNames = getSortedHeaderNames(new ArrayList<>(), curHeaderNames, "", "Content", - Content.class); - sortedHeaderNames.addAll(getSortedHeaderNames(new ArrayList<>(), curHeaderNames, "", "Management", - Management.class)); + sortedHeaderNames = getSortedHeaderNames(new ArrayList<>(), curHeaderNames, "", "Content", Content.class); + sortedHeaderNames.addAll( + getSortedHeaderNames(new ArrayList<>(), curHeaderNames, "", "Management", Management.class) + ); this.headerNames = sortedHeaderNames; } @@ -378,8 +405,7 @@ private void printCsvHeader() { csvPrintStream.print("File"); if (extendedFormatFlag) csvPrintStream.print(separator + "ObjectFiles"); - for (String header : simplifiedHeaderNames) - csvPrintStream.print(separator + header); + for (String header : simplifiedHeaderNames) csvPrintStream.print(separator + header); csvPrintStream.println(); } @@ -421,8 +447,9 @@ private void generateCsvLine(ArchiveUnit au, ArchiveUnit parentAu, Path auRelati } else { for (BinaryDataObject bdo : bdoList) { Path objectPath; - if (fileExportFlag) - objectPath = auRelativePath.resolve(constructObjectFileName(auRelativePath, bdo, bdoList.size() == 1, false)); + if (fileExportFlag) objectPath = auRelativePath.resolve( + constructObjectFileName(auRelativePath, bdo, bdoList.size() == 1, false) + ); else objectPath = bdo.getOnDiskPath(); value += "|" + getSimplifiedPath(objectPath); } @@ -446,15 +473,20 @@ private void generateCsvLine(ArchiveUnit au, ArchiveUnit parentAu, Path auRelati // get the best Usage_Version object in a list of objects. First find the best Usage and then find the first or // last version of this usage depending on firstFlag - private BinaryDataObject getBestUsageVersionObject(List objectList, boolean firstFlag) throws InterruptedException { + private BinaryDataObject getBestUsageVersionObject(List objectList, boolean firstFlag) + throws InterruptedException { int rank; int version; TreeMap rankMap = new TreeMap<>(); for (BinaryDataObject bdo : objectList) { - StringType dataObjectVersion= bdo.getMetadataDataObjectVersion(); + StringType dataObjectVersion = bdo.getMetadataDataObjectVersion(); if ((dataObjectVersion == null) || (dataObjectVersion.getValue().isEmpty())) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_WARNINGS, "Un objet binaire n'a pas d'usage_version," + - " il ne peut être choisi pour l'extraction", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_WARNINGS, + "Un objet binaire n'a pas d'usage_version," + " il ne peut être choisi pour l'extraction", + null + ); continue; } String[] usageVersion = dataObjectVersion.getValue().split("_"); @@ -474,25 +506,26 @@ private BinaryDataObject getBestUsageVersionObject(List object default: rank = 4; } - if (usageVersion.length == 1) - version = 1; + if (usageVersion.length == 1) version = 1; else { try { version = Integer.parseInt(usageVersion[1]); } catch (NumberFormatException e) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_WARNINGS, "Un objet binaire n'a pas d'usage_version," + - " il ne peut être choisi pour l'extraction", e); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_WARNINGS, + "Un objet binaire n'a pas d'usage_version," + " il ne peut être choisi pour l'extraction", + e + ); continue; } } rankMap.put(rank * 1000 + version, bdo); } //no result - if (rankMap.size() == 0) - return null; + if (rankMap.size() == 0) return null; //the first version of best usage - if (firstFlag) - return rankMap.firstEntry().getValue(); + if (firstFlag) return rankMap.firstEntry().getValue(); //the last version of best usage rank = rankMap.firstKey() / 1000; BinaryDataObject bdo = null; @@ -505,26 +538,27 @@ private BinaryDataObject getBestUsageVersionObject(List object // get the list of all objects in an ArchiveUnit (with DataObjectGroup or not) private List getArchiveUnitObjectList(ArchiveUnit au) throws InterruptedException { - if ((au.getDataObjectRefList() == null) || (au.getDataObjectRefList().getCount() == 0)) - return null; + if ((au.getDataObjectRefList() == null) || (au.getDataObjectRefList().getCount() == 0)) return null; ArrayList objectList = new ArrayList<>(); for (DataObject dataObject : au.getDataObjectRefList().getDataObjectList()) { - if (dataObject instanceof BinaryDataObject) - objectList.add((BinaryDataObject) dataObject); - else if (dataObject instanceof DataObjectGroup) - objectList.addAll(((DataObjectGroup) dataObject).getBinaryDataObjectList()); - } - if (usageVersionSelectionMode == ALL_DATAOBJECTS) - return objectList; - else - return Collections.singletonList(getBestUsageVersionObject(objectList, usageVersionSelectionMode == FIRST_DATAOBJECT)); + if (dataObject instanceof BinaryDataObject) objectList.add((BinaryDataObject) dataObject); + else if (dataObject instanceof DataObjectGroup) objectList.addAll( + ((DataObjectGroup) dataObject).getBinaryDataObjectList() + ); + } + if (usageVersionSelectionMode == ALL_DATAOBJECTS) return objectList; + else return Collections.singletonList( + getBestUsageVersionObject(objectList, usageVersionSelectionMode == FIRST_DATAOBJECT) + ); } // strip a String of all characters not allowed in a file name, and from ending points and space private String stripFileName(String fileName) { String filteredName = fileName.replaceAll("[\\/|\\\\|\\*|\\:|\\||\"|\'|\\<|\\>|\\{|\\}|\\?|\\%|,]", "_"); - while (filteredName.endsWith(".") || filteredName.endsWith(" ")) - filteredName = filteredName.substring(0, filteredName.length() - 1); + while (filteredName.endsWith(".") || filteredName.endsWith(" ")) filteredName = filteredName.substring( + 0, + filteredName.length() - 1 + ); return filteredName; } @@ -533,22 +567,16 @@ private String constructArchiveUnitDirectoryName(Path auRrelativePath, ArchiveUn String dirName = ""; if (au.getContent() != null) { dirName = au.getContent().getSimpleMetadata("Title"); - if (dirName == null) - dirName = "NoTitle"; - if ((maxNameSize > 0) && (dirName.length() > maxNameSize)) - dirName = dirName.substring(0, maxNameSize); + if (dirName == null) dirName = "NoTitle"; + if ((maxNameSize > 0) && (dirName.length() > maxNameSize)) dirName = dirName.substring(0, maxNameSize); dirName = stripFileName(dirName); dirName = dirName.trim(); if (fileExists(auRrelativePath.resolve(dirName))) { String id = stripFileName("-" + au.getInDataObjectPackageId()); - if (maxNameSize <= 0) - dirName += id; - else if (id.length() >= maxNameSize) - dirName = id; - else if (id.length() + dirName.length() <= maxNameSize) - dirName += id; - else - dirName = dirName.substring(0, maxNameSize - id.length()) + id; + if (maxNameSize <= 0) dirName += id; + else if (id.length() >= maxNameSize) dirName = id; + else if (id.length() + dirName.length() <= maxNameSize) dirName += id; + else dirName = dirName.substring(0, maxNameSize - id.length()) + id; } } @@ -557,11 +585,16 @@ else if (id.length() + dirName.length() <= maxNameSize) // Construct file name for Object, either uniq or in a list of different usage_version and insert id if already // exists. - private String constructObjectFileName(Path auRrelativePath, BinaryDataObject bdo, boolean uniqFlag, boolean firstTime) { + private String constructObjectFileName( + Path auRrelativePath, + BinaryDataObject bdo, + boolean uniqFlag, + boolean firstTime + ) { String filename = null; String name; String ext; - FileInfo fileInfo= bdo.getMetadataFileInfo(); + FileInfo fileInfo = bdo.getMetadataFileInfo(); if (fileInfo != null) filename = fileInfo.getSimpleMetadata("Filename"); if (filename == null) filename = "undefined"; int point = filename.lastIndexOf('.'); @@ -575,7 +608,7 @@ private String constructObjectFileName(Path auRrelativePath, BinaryDataObject bd if (!uniqFlag) { String usageVersion; - StringType dataObjectVersion= bdo.getMetadataDataObjectVersion(); + StringType dataObjectVersion = bdo.getMetadataDataObjectVersion(); if (dataObjectVersion == null) usageVersion = "undefined_1"; else usageVersion = dataObjectVersion.getValue(); name = "__" + usageVersion + "__" + name; @@ -583,8 +616,9 @@ private String constructObjectFileName(Path auRrelativePath, BinaryDataObject bd if (firstTime) { filename = stripFileName(name + ext); - if (fileExists(auRrelativePath.resolve(filename))) - filename = stripFileName(name + "-" + bdo.getInDataObjectPackageId() + ext); + if (fileExists(auRrelativePath.resolve(filename))) filename = stripFileName( + name + "-" + bdo.getInDataObjectPackageId() + ext + ); } else { filename = stripFileName(name + "-" + bdo.getInDataObjectPackageId() + ext); if (!fileExists(auRrelativePath.resolve(filename))) filename = stripFileName(name + ext); @@ -597,73 +631,89 @@ private boolean fileExists(Path relativePath) { } private void createDirectories(Path relativePath) throws SEDALibException { - if (zipOS == null) - try { - Files.createDirectories((relativePath == null ? rootPath : rootPath.resolve(relativePath))); - } catch (Exception e) { - throw new SEDALibException( - "Création du répertoire [" + (relativePath == null ? rootPath : rootPath.resolve(relativePath)) + "] impossible", e); - } - else if ((relativePath != null) && !relativePathStringSet.contains(relativePath.toString())) - try { - ZipEntry e = new ZipEntry((relativePath.toString() + File.separator).replace('\\', '/')); - zipOS.putNextEntry(e); - zipOS.closeEntry(); - } catch (IOException e) { - throw new SEDALibException( - "Création du répertoire [" + relativePath.toString() + - "] dans le zip [" + rootPath.resolve(zipFileName).toString() + "] impossible", e); - } + if (zipOS == null) try { + Files.createDirectories((relativePath == null ? rootPath : rootPath.resolve(relativePath))); + } catch (Exception e) { + throw new SEDALibException( + "Création du répertoire [" + + (relativePath == null ? rootPath : rootPath.resolve(relativePath)) + + "] impossible", + e + ); + } + else if ((relativePath != null) && !relativePathStringSet.contains(relativePath.toString())) try { + ZipEntry e = new ZipEntry((relativePath.toString() + File.separator).replace('\\', '/')); + zipOS.putNextEntry(e); + zipOS.closeEntry(); + } catch (IOException e) { + throw new SEDALibException( + "Création du répertoire [" + + relativePath.toString() + + "] dans le zip [" + + rootPath.resolve(zipFileName).toString() + + "] impossible", + e + ); + } - if (relativePath != null) - relativePathStringSet.add(relativePath.toString()); + if (relativePath != null) relativePathStringSet.add(relativePath.toString()); } private void writeString(Path relativePath, String content) throws SEDALibException { - if (zipOS == null) - try { - Files.write(rootPath.resolve(relativePath), content.getBytes(StandardCharsets.UTF_8)); - } catch (IOException e) { - throw new SEDALibException( - "Ecriture du fichier [" + rootPath.resolve(relativePath).toString() + "] impossible", e); - } - else - try { - ZipEntry e = new ZipEntry(relativePath.toString().replace('\\', '/')); - zipOS.putNextEntry(e); - zipOS.write(content.getBytes(StandardCharsets.UTF_8)); - zipOS.closeEntry(); - } catch (IOException e) { - throw new SEDALibException( - "Ecriture du fichier [" + relativePath.toString() + - "] dans le zip [" + rootPath.resolve(zipFileName).toString() + "] impossible", e); - } + if (zipOS == null) try { + Files.write(rootPath.resolve(relativePath), content.getBytes(StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new SEDALibException( + "Ecriture du fichier [" + rootPath.resolve(relativePath).toString() + "] impossible", + e + ); + } + else try { + ZipEntry e = new ZipEntry(relativePath.toString().replace('\\', '/')); + zipOS.putNextEntry(e); + zipOS.write(content.getBytes(StandardCharsets.UTF_8)); + zipOS.closeEntry(); + } catch (IOException e) { + throw new SEDALibException( + "Ecriture du fichier [" + + relativePath.toString() + + "] dans le zip [" + + rootPath.resolve(zipFileName).toString() + + "] impossible", + e + ); + } relativePathStringSet.add(relativePath.toString()); } private void copyFile(Path originPath, Path relativePath) throws SEDALibException { - if (zipOS == null) - try { - Files.copy(originPath, rootPath.resolve(relativePath), StandardCopyOption.REPLACE_EXISTING); - } catch (IOException e) { - throw new SEDALibException( - "Ecriture du fichier [" + rootPath.resolve(relativePath).toString() + "] impossible", e); - } - else - try { - ZipEntry e = new ZipEntry(relativePath.toString().replace('\\', '/')); - zipOS.putNextEntry(e); - try (FileInputStream fis = new FileInputStream(originPath.toFile())) { - int l; - byte[] buffer = new byte[65536]; - while ((l = fis.read(buffer)) != -1) zipOS.write(buffer, 0, l); - } - zipOS.closeEntry(); - } catch (IOException e) { - throw new SEDALibException( - "Ecriture du fichier [" + relativePath.toString() + - "] dans le zip [" + rootPath.resolve(zipFileName).toString() + "] impossible", e); + if (zipOS == null) try { + Files.copy(originPath, rootPath.resolve(relativePath), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + throw new SEDALibException( + "Ecriture du fichier [" + rootPath.resolve(relativePath).toString() + "] impossible", + e + ); + } + else try { + ZipEntry e = new ZipEntry(relativePath.toString().replace('\\', '/')); + zipOS.putNextEntry(e); + try (FileInputStream fis = new FileInputStream(originPath.toFile())) { + int l; + byte[] buffer = new byte[65536]; + while ((l = fis.read(buffer)) != -1) zipOS.write(buffer, 0, l); } + zipOS.closeEntry(); + } catch (IOException e) { + throw new SEDALibException( + "Ecriture du fichier [" + + relativePath.toString() + + "] dans le zip [" + + rootPath.resolve(zipFileName).toString() + + "] impossible", + e + ); + } relativePathStringSet.add(relativePath.toString()); } @@ -672,16 +722,21 @@ private void exportLink(ArchiveUnit au, Path auRelativePath) throws SEDALibExcep Path originAURelativePath = auRelativePathMap.get(au); Path auPath = rootPath.resolve(auRelativePath).resolve(originAURelativePath.getFileName().toString() + ".link"); boolean linkFlag = false; - if (zipOS == null) - try { - createDirectories(auPath.getParent()); - Files.createSymbolicLink(auPath.toAbsolutePath(), - auPath.getParent().relativize(rootPath.resolve(originAURelativePath))); - linkFlag = true; - } catch (IOException e) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_WARNINGS, "Lien vers [" + - rootPath.resolve(originAURelativePath).toString() + "] n'a pas pu être créé", e); - } + if (zipOS == null) try { + createDirectories(auPath.getParent()); + Files.createSymbolicLink( + auPath.toAbsolutePath(), + auPath.getParent().relativize(rootPath.resolve(originAURelativePath)) + ); + linkFlag = true; + } catch (IOException e) { + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_WARNINGS, + "Lien vers [" + rootPath.resolve(originAURelativePath).toString() + "] n'a pas pu être créé", + e + ); + } if (!linkFlag) { writeString(rootPath.toAbsolutePath().relativize(auPath), "Link to " + originAURelativePath.toString()); } @@ -691,21 +746,20 @@ private void exportLink(ArchiveUnit au, Path auRelativePath) throws SEDALibExcep private String exportObjectList(Path auRelativePath, List objectList) throws SEDALibException { String filename = null; - if (fileExportFlag) - createDirectories(auRelativePath); + if (fileExportFlag) createDirectories(auRelativePath); if ((objectList != null) && !objectList.isEmpty()) { for (BinaryDataObject bdo : objectList) { filename = constructObjectFileName(auRelativePath, bdo, objectList.size() == 1, true); - if (fileExportFlag) - copyFile(bdo.getOnDiskPath(), auRelativePath.resolve(filename)); + if (fileExportFlag) copyFile(bdo.getOnDiskPath(), auRelativePath.resolve(filename)); } } return filename; } // Recursively export all ArchiveUnit files and metadata to disk. - private void exportArchiveUnit(ArchiveUnit au, ArchiveUnit parentAu, Path relativePath) throws SEDALibException, InterruptedException { + private void exportArchiveUnit(ArchiveUnit au, ArchiveUnit parentAu, Path relativePath) + throws SEDALibException, InterruptedException { Path auRelativePath; String filename; @@ -716,52 +770,57 @@ private void exportArchiveUnit(ArchiveUnit au, ArchiveUnit parentAu, Path relati List objectList = getArchiveUnitObjectList(au); // if not only a file ArchiveUnit create a named directory with the ArchiveUnit Title - if (((au.getChildrenAuList() != null) && (au.getChildrenAuList().getCount() != 0)) || - ((objectList == null) || objectList.size() != 1)) { + if ( + ((au.getChildrenAuList() != null) && (au.getChildrenAuList().getCount() != 0)) || + ((objectList == null) || objectList.size() != 1) + ) { auRelativePath = relativePath.resolve(constructArchiveUnitDirectoryName(relativePath, au)); } else auRelativePath = relativePath; filename = exportObjectList(auRelativePath, objectList); // if a file ArchiveUnit the kept path for links is the file path - if (auRelativePath == relativePath) - auRelativePath = auRelativePath.resolve(filename); + if (auRelativePath == relativePath) auRelativePath = auRelativePath.resolve(filename); auRelativePathMap.put(au, auRelativePath); // recursively export if ((au.getChildrenAuList() != null) && (au.getChildrenAuList().getCount() != 0)) { - for (ArchiveUnit childAU : au.getChildrenAuList().getArchiveUnitList()) - exportArchiveUnit(childAU, au, auRelativePath); + for (ArchiveUnit childAU : au.getChildrenAuList().getArchiveUnitList()) exportArchiveUnit( + childAU, + au, + auRelativePath + ); } generateCsvLine(au, parentAu, auRelativePath); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, "sedalib: " + Integer.toString(counter) + " ArchiveUnit exportées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + Integer.toString(counter) + " ArchiveUnit exportées" + ); } private String getDescription(Date d) { String log = "Début de l'export csv simplifié"; - if (!fileExportFlag) - log += " (csv seul)\n"; - else - log += " (csv et fichiers)\n"; - if (zipFileName != null) - log += "dans le zip [" + rootPath.resolve(zipFileName).toString() + "]"; - else - log += "dans le répertoire [" + rootPath.toString() + "]"; + if (!fileExportFlag) log += " (csv seul)\n"; + else log += " (csv et fichiers)\n"; + if (zipFileName != null) log += "dans le zip [" + rootPath.resolve(zipFileName).toString() + "]"; + else log += "dans le répertoire [" + rootPath.toString() + "]"; log += " date=" + DateFormat.getDateTimeInstance().format(d); return log; } private void defineZipOutputStreamOrNull(Path rootPath, String zipFileName) throws SEDALibException { - if (zipFileName == null) - zipOS = null; - else - try { - zipOS = new ZipOutputStream(new FileOutputStream(rootPath.resolve(zipFileName).toFile())); - } catch (IOException e) { - throw new SEDALibException( - "Création du conteneur zip [" + rootPath.resolve(zipFileName).toString() + "] impossible", e); - } + if (zipFileName == null) zipOS = null; + else try { + zipOS = new ZipOutputStream(new FileOutputStream(rootPath.resolve(zipFileName).toFile())); + } catch (IOException e) { + throw new SEDALibException( + "Création du conteneur zip [" + rootPath.resolve(zipFileName).toString() + "] impossible", + e + ); + } } private void createCsvBAOSPrintScream() throws SEDALibException { @@ -775,26 +834,35 @@ private void createCsvBAOSPrintScream() throws SEDALibException { private void finaliseWithCsvMetadataFile() throws SEDALibException { csvPrintStream.flush(); - if (zipOS != null) - try { - ZipEntry e = new ZipEntry(csvMetadataFileName); - zipOS.putNextEntry(e); - zipOS.write(csvBAOS.toByteArray()); - zipOS.closeEntry(); - zipOS.close(); - zipOS = null; - } catch (IOException e) { - throw new SEDALibException( - "Finalisation du conteneur zip [" + rootPath.resolve(zipFileName).toString() + - "] avec sauvegarde du fichier de métadonnées [" + csvMetadataFileName + "] impossible", e); - } + if (zipOS != null) try { + ZipEntry e = new ZipEntry(csvMetadataFileName); + zipOS.putNextEntry(e); + zipOS.write(csvBAOS.toByteArray()); + zipOS.closeEntry(); + zipOS.close(); + zipOS = null; + } catch (IOException e) { + throw new SEDALibException( + "Finalisation du conteneur zip [" + + rootPath.resolve(zipFileName).toString() + + "] avec sauvegarde du fichier de métadonnées [" + + csvMetadataFileName + + "] impossible", + e + ); + } else { try { FileUtils.writeByteArrayToFile(rootPath.resolve(csvMetadataFileName).toFile(), csvBAOS.toByteArray()); } catch (IOException e) { throw new SEDALibException( - "Finalisation de l'export en [" + rootPath.toString() + - "] avec sauvegarde du fichier de métadonnées [" + csvMetadataFileName + "] impossible", e); + "Finalisation de l'export en [" + + rootPath.toString() + + "] avec sauvegarde du fichier de métadonnées [" + + csvMetadataFileName + + "] impossible", + e + ); } } csvPrintStream.close(); @@ -807,8 +875,17 @@ private void finaliseWithCsvMetadataFile() throws SEDALibException { private void exportAll() throws SEDALibException, InterruptedException { Date d = new Date(); start = Instant.now(); - String log = "sedalib: début de l'export d'un csv " + (fileExportFlag ? "et de sa hiérarchie" : "") + (zipFileName == null ? " dans un zip" : "") + "\n"; - log += "en [" + (fileExportFlag ? (zipFileName == null ? rootPath : rootPath.resolve(zipFileName)) : rootPath.resolve(csvMetadataFileName)) + "] date="; + String log = + "sedalib: début de l'export d'un csv " + + (fileExportFlag ? "et de sa hiérarchie" : "") + + (zipFileName == null ? " dans un zip" : "") + + "\n"; + log += + "en [" + + (fileExportFlag + ? (zipFileName == null ? rootPath : rootPath.resolve(zipFileName)) + : rootPath.resolve(csvMetadataFileName)) + + "] date="; log += DateFormat.getDateTimeInstance().format(d); doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); @@ -823,13 +900,25 @@ private void exportAll() throws SEDALibException, InterruptedException { printCsvHeader(); dataObjectPackage.resetInOutCounter(); - for (ArchiveUnit au : dataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList()) - exportArchiveUnit(au, null, Paths.get("")); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, "sedalib: " + dataObjectPackage.getInOutCounter() + " ArchiveUnit exportées", null); + for (ArchiveUnit au : dataObjectPackage + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList()) exportArchiveUnit(au, null, Paths.get("")); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: " + dataObjectPackage.getInOutCounter() + " ArchiveUnit exportées", + null + ); finaliseWithCsvMetadataFile(); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: export csv simplifié terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: export csv simplifié terminé", + null + ); end = Instant.now(); } @@ -840,7 +929,8 @@ private void exportAll() throws SEDALibException, InterruptedException { * @throws SEDALibException if writing has failed * @throws InterruptedException if export process is interrupted */ - public void doExportToCSVMetadataFile(String csvMetadataFilePathName) throws SEDALibException, InterruptedException { + public void doExportToCSVMetadataFile(String csvMetadataFilePathName) + throws SEDALibException, InterruptedException { this.rootPath = Paths.get(csvMetadataFilePathName).toAbsolutePath().getParent().normalize(); this.zipFileName = null; this.csvMetadataFileName = Paths.get(csvMetadataFilePathName).getFileName().toString(); @@ -865,7 +955,8 @@ public void doExportToCSVMetadataFile(String csvMetadataFilePathName) throws SED * @throws SEDALibException if writing has failed * @throws InterruptedException if export process is interrupted */ - public void doExportToCSVDiskHierarchy(String dirPathName, String csvMetadataFileName) throws SEDALibException, InterruptedException { + public void doExportToCSVDiskHierarchy(String dirPathName, String csvMetadataFileName) + throws SEDALibException, InterruptedException { this.rootPath = Paths.get(dirPathName).toAbsolutePath().normalize(); this.zipFileName = null; this.csvMetadataFileName = csvMetadataFileName; @@ -890,7 +981,8 @@ public void doExportToCSVDiskHierarchy(String dirPathName, String csvMetadataFil * @throws SEDALibException if writing has failed * @throws InterruptedException if export process is interrupted */ - public void doExportToCSVZip(String zipFilePathName, String csvMetadataFileName) throws SEDALibException, InterruptedException { + public void doExportToCSVZip(String zipFilePathName, String csvMetadataFileName) + throws SEDALibException, InterruptedException { this.rootPath = Paths.get(zipFilePathName).toAbsolutePath().getParent().normalize(); this.zipFileName = Paths.get(zipFilePathName).getFileName().toString(); this.csvMetadataFileName = csvMetadataFileName; @@ -920,8 +1012,8 @@ public String getSummary() { result += "???\n"; } - if ((start != null) && (end != null)) - result += "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; + if ((start != null) && (end != null)) result += + "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java index f6631644..3259cc27 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/DataObjectPackageToDiskExporter.java @@ -167,7 +167,10 @@ private DataObjectPackageToDiskExporter(SEDALibProgressLogger sedaLibProgressLog * @param dataObjectPackage the archive transfer * @param sedaLibProgressLogger the progress logger */ - public DataObjectPackageToDiskExporter(DataObjectPackage dataObjectPackage, SEDALibProgressLogger sedaLibProgressLogger) { + public DataObjectPackageToDiskExporter( + DataObjectPackage dataObjectPackage, + SEDALibProgressLogger sedaLibProgressLogger + ) { this(sedaLibProgressLogger); this.dataObjectPackage = dataObjectPackage; } @@ -180,16 +183,13 @@ public DataObjectPackageToDiskExporter(DataObjectPackage dataObjectPackage, SEDA */ private String constructFileName(BinaryDataObject binaryDataObject) { String result; - StringType dataObjectVersion= binaryDataObject.getMetadataDataObjectVersion(); - if (dataObjectVersion == null) - result = "__undefined__"; + StringType dataObjectVersion = binaryDataObject.getMetadataDataObjectVersion(); + if (dataObjectVersion == null) result = "__undefined__"; else result = "__" + dataObjectVersion.getValue() + "__"; - FileInfo fileInfo= binaryDataObject.getMetadataFileInfo(); - if ((fileInfo != null) && - (fileInfo.getSimpleMetadata("Filename") != null)) - result += fileInfo.getSimpleMetadata("Filename"); - else - result += "NoName"; + FileInfo fileInfo = binaryDataObject.getMetadataFileInfo(); + if ((fileInfo != null) && (fileInfo.getSimpleMetadata("Filename") != null)) result += + fileInfo.getSimpleMetadata("Filename"); + else result += "NoName"; return stripFileName(result); } @@ -201,11 +201,9 @@ private String constructFileName(BinaryDataObject binaryDataObject) { */ private String constructMetadataFileName(BinaryDataObject binaryDataObject) { String result; - StringType dataObjectVersion= binaryDataObject.getMetadataDataObjectVersion(); - if (dataObjectVersion == null) - result = "__undefined__BinaryDataObjectMetadata.xml"; - else - result = "__" + dataObjectVersion.getValue() + "__BinaryDataObjectMetadata.xml"; + StringType dataObjectVersion = binaryDataObject.getMetadataDataObjectVersion(); + if (dataObjectVersion == null) result = "__undefined__BinaryDataObjectMetadata.xml"; + else result = "__" + dataObjectVersion.getValue() + "__BinaryDataObjectMetadata.xml"; return stripFileName(result); } @@ -217,11 +215,9 @@ private String constructMetadataFileName(BinaryDataObject binaryDataObject) { */ private String constructMetadataFileName(PhysicalDataObject physicalDataObject) { String result; - StringType dataObjectVersion=physicalDataObject.getMetadataDataObjectVersion(); - if (dataObjectVersion == null) - result = "__undefined__PhysicalDataObjectMetadata.xml"; - else - result = "__" + dataObjectVersion.getValue() + "__PhysicalDataObjectMetadata.xml"; + StringType dataObjectVersion = physicalDataObject.getMetadataDataObjectVersion(); + if (dataObjectVersion == null) result = "__undefined__PhysicalDataObjectMetadata.xml"; + else result = "__" + dataObjectVersion.getValue() + "__PhysicalDataObjectMetadata.xml"; return stripFileName(result); } @@ -235,10 +231,8 @@ private String constructDirectoryName(ArchiveUnit au) throws SEDALibException { String result = ""; if (au.getContent() != null) { result = au.getContent().getSimpleMetadata("Title"); - if (result == null) - result = "NoTitle"; - else if (result.length() > 12) - result = result.substring(0, 11); + if (result == null) result = "NoTitle"; + else if (result.length() > 12) result = result.substring(0, 11); result = result.replaceAll("[^\\p{IsAlphabetic}\\p{Digit}]", "-"); result += "_"; } @@ -255,8 +249,10 @@ else if (result.length() > 12) @SuppressWarnings("Annotator") private String stripFileName(String fileName) { String filteredName = fileName.replaceAll("[\\/|\\\\|\\*|\\:|\\||\"|\'|\\<|\\>|\\{|\\}|\\?|\\%|,]", "_"); - while (filteredName.endsWith(".") || filteredName.endsWith(" ")) - filteredName = filteredName.substring(0, filteredName.length() - 1); + while (filteredName.endsWith(".") || filteredName.endsWith(" ")) filteredName = filteredName.substring( + 0, + filteredName.length() - 1 + ); return filteredName; } @@ -273,8 +269,10 @@ public void exportManagementMetadata(String xmlData, Path containerPath) throws // write binary file targetOnDiskPath = containerPath.resolve("__ManagementMetadata.xml"); filesPathSet.add(targetOnDiskPath); - try (FileOutputStream fos = new FileOutputStream(targetOnDiskPath.toFile()); - Writer rawWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) { + try ( + FileOutputStream fos = new FileOutputStream(targetOnDiskPath.toFile()); + Writer rawWriter = new OutputStreamWriter(fos, StandardCharsets.UTF_8) + ) { try { identXml = IndentXMLTool.getInstance(2).indentString(xmlData); } catch (Exception e) { @@ -283,7 +281,8 @@ public void exportManagementMetadata(String xmlData, Path containerPath) throws rawWriter.write(identXml); } catch (Exception e) { throw new SEDALibException( - "Ecriture des ManagementMetadata [" + targetOnDiskPath + "] impossible\n->" + e.getMessage()); + "Ecriture des ManagementMetadata [" + targetOnDiskPath + "] impossible\n->" + e.getMessage() + ); } } @@ -298,17 +297,16 @@ private void determineExplicitDataObjectGroupInArchiveUnit(ArchiveUnit archiveUn boolean complexDataObjectRefList = (archiveUnit.getDataObjectRefList().getDataObjectList().size() > 1); for (DataObject zdo : archiveUnit.getDataObjectRefList().getDataObjectList()) { if (zdo instanceof DataObjectGroup) { - if (complexDataObjectRefList - || (dataObjectPackage.isTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()))) - dogPathStringMap.put((DataObjectGroup) zdo, emptyPath); - else - dataObjectPackage.addTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()); + if ( + complexDataObjectRefList || + (dataObjectPackage.isTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId())) + ) dogPathStringMap.put((DataObjectGroup) zdo, emptyPath); + else dataObjectPackage.addTouchedInDataObjectPackageId(zdo.getInDataObjectPackageId()); } } for (ArchiveUnit childAu : archiveUnit.getChildrenAuList().getArchiveUnitList()) { determineExplicitDataObjectGroupInArchiveUnit(childAu); } - } /** @@ -316,8 +314,10 @@ private void determineExplicitDataObjectGroupInArchiveUnit(ArchiveUnit archiveUn */ private void determineExplicitDataObjectGroupMap() { dataObjectPackage.resetTouchedInDataObjectPackageIdMap(); - for (ArchiveUnit au : dataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList()) - determineExplicitDataObjectGroupInArchiveUnit(au); + for (ArchiveUnit au : dataObjectPackage + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList()) determineExplicitDataObjectGroupInArchiveUnit(au); } /** @@ -331,27 +331,40 @@ public void exportBinaryDataObject(BinaryDataObject bdo, Path containerPath) thr Path targetOnDiskPath; // write binary file targetOnDiskPath = containerPath.resolve(constructFileName(bdo)); - if (filesPathSet.contains(targetOnDiskPath)) - throw new SEDALibException("Collision de fichiers de représentation [" + targetOnDiskPath.toString() - + "] détectée sur le BinaryDataObject [" + bdo.getInDataObjectPackageId() + "]"); + if (filesPathSet.contains(targetOnDiskPath)) throw new SEDALibException( + "Collision de fichiers de représentation [" + + targetOnDiskPath.toString() + + "] détectée sur le BinaryDataObject [" + + bdo.getInDataObjectPackageId() + + "]" + ); filesPathSet.add(targetOnDiskPath); try { Files.copy(bdo.getOnDiskPath(), targetOnDiskPath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { - throw new SEDALibException("Ecriture du BinaryDataObject [" + bdo.getInDataObjectPackageId() - + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Ecriture du BinaryDataObject [" + bdo.getInDataObjectPackageId() + "] impossible\n->" + e.getMessage() + ); } // write metadata file targetOnDiskPath = containerPath.resolve(constructMetadataFileName(bdo)); - if (filesPathSet.contains(targetOnDiskPath)) - throw new SEDALibException("Collision de fichiers de représentation [" + targetOnDiskPath.toString() - + "] détectée sur le BinaryDataObject [" + bdo.getInDataObjectPackageId() + "]"); + if (filesPathSet.contains(targetOnDiskPath)) throw new SEDALibException( + "Collision de fichiers de représentation [" + + targetOnDiskPath.toString() + + "] détectée sur le BinaryDataObject [" + + bdo.getInDataObjectPackageId() + + "]" + ); filesPathSet.add(targetOnDiskPath); try { Files.write(targetOnDiskPath, bdo.toSedaXmlFragments().getBytes(StandardCharsets.UTF_8)); } catch (Exception e) { - throw new SEDALibException("Ecriture des métadonnées du BinaryDataObject [" + bdo.getInDataObjectPackageId() - + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Ecriture des métadonnées du BinaryDataObject [" + + bdo.getInDataObjectPackageId() + + "] impossible\n->" + + e.getMessage() + ); } } @@ -366,15 +379,23 @@ private void exportPhysicalDataObject(PhysicalDataObject pdo, Path containerPath Path targetOnDiskPath; // write metadata file targetOnDiskPath = containerPath.resolve(constructMetadataFileName(pdo)); - if (filesPathSet.contains(targetOnDiskPath)) - throw new SEDALibException("Collision de fichiers de représentation [" + targetOnDiskPath.toString() - + "] détectée sur le PhysicalDataObject [" + pdo.getInDataObjectPackageId() + "]"); + if (filesPathSet.contains(targetOnDiskPath)) throw new SEDALibException( + "Collision de fichiers de représentation [" + + targetOnDiskPath.toString() + + "] détectée sur le PhysicalDataObject [" + + pdo.getInDataObjectPackageId() + + "]" + ); filesPathSet.add(targetOnDiskPath); try { Files.write(targetOnDiskPath, pdo.toSedaXmlFragments().getBytes(StandardCharsets.UTF_8)); } catch (Exception e) { - throw new SEDALibException("Ecriture des métadonnées du PhysicalDataObject [" - + pdo.getInDataObjectPackageId() + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Ecriture des métadonnées du PhysicalDataObject [" + + pdo.getInDataObjectPackageId() + + "] impossible\n->" + + e.getMessage() + ); } } @@ -386,10 +407,8 @@ private void exportPhysicalDataObject(PhysicalDataObject pdo, Path containerPath * @throws SEDALibException if writing has failed */ private void exportDataObjectGroupContent(DataObjectGroup dog, Path containerPath) throws SEDALibException { - for (BinaryDataObject bdo : dog.getBinaryDataObjectList()) - exportBinaryDataObject(bdo, containerPath); - for (PhysicalDataObject pdo : dog.getPhysicalDataObjectList()) - exportPhysicalDataObject(pdo, containerPath); + for (BinaryDataObject bdo : dog.getBinaryDataObjectList()) exportBinaryDataObject(bdo, containerPath); + for (PhysicalDataObject pdo : dog.getPhysicalDataObjectList()) exportPhysicalDataObject(pdo, containerPath); } /** @@ -408,7 +427,8 @@ private Path exportDataObjectGroup(DataObjectGroup dog, Path containerPath) thro Files.createDirectories(targetOnDiskPath); } catch (Exception e) { throw new SEDALibException( - "Création du répertoire [" + targetOnDiskPath + "] impossible\n->" + e.getMessage()); + "Création du répertoire [" + targetOnDiskPath + "] impossible\n->" + e.getMessage() + ); } exportDataObjectGroupContent(dog, targetOnDiskPath); return targetOnDiskPath; @@ -427,34 +447,45 @@ private Path exportDataObjectGroup(DataObjectGroup dog, Path containerPath) thro * rights are not high enough. * @throws InterruptedException if interrupted */ - private void exportLink(Path target, Path containerPath, String newLink) throws SEDALibException, InterruptedException { + private void exportLink(Path target, Path containerPath, String newLink) + throws SEDALibException, InterruptedException { Path linkOnDiskPath; // write link linkOnDiskPath = containerPath.resolve(newLink); - if (filesPathSet.contains(linkOnDiskPath)) - throw new SEDALibException("Collision de fichiers de représentation [" + linkOnDiskPath.toString() - + "] pour la création d'un lien"); + if (filesPathSet.contains(linkOnDiskPath)) throw new SEDALibException( + "Collision de fichiers de représentation [" + linkOnDiskPath.toString() + "] pour la création d'un lien" + ); filesPathSet.add(linkOnDiskPath); try { - if (Files.exists(linkOnDiskPath, LinkOption.NOFOLLOW_LINKS)) - Files.delete(linkOnDiskPath); - Files.createSymbolicLink(linkOnDiskPath, linkOnDiskPath.toAbsolutePath().getParent().relativize(target.toAbsolutePath())); + if (Files.exists(linkOnDiskPath, LinkOption.NOFOLLOW_LINKS)) Files.delete(linkOnDiskPath); + Files.createSymbolicLink( + linkOnDiskPath, + linkOnDiskPath.toAbsolutePath().getParent().relativize(target.toAbsolutePath()) + ); } catch (Exception e) { if (isWindows) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_WARNINGS, - "sedalib: la création de lien n'a pas pu avoir lieu, essai de création de raccourci sous Windows", e); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_WARNINGS, + "sedalib: la création de lien n'a pas pu avoir lieu, essai de création de raccourci sous Windows", + e + ); ShellLink sl = new ShellLink(); sl.setTarget(target.toString()); try { - if (Files.exists(Paths.get(linkOnDiskPath.toString() + ".lnk"), LinkOption.NOFOLLOW_LINKS)) - Files.delete(Paths.get(linkOnDiskPath.toString() + ".lnk")); + if ( + Files.exists(Paths.get(linkOnDiskPath.toString() + ".lnk"), LinkOption.NOFOLLOW_LINKS) + ) Files.delete(Paths.get(linkOnDiskPath.toString() + ".lnk")); sl.saveTo(linkOnDiskPath.toString() + ".lnk"); } catch (IOException e1) { - throw new SEDALibException("Création du lien et du raccourci [" + linkOnDiskPath - + "] impossible", e1); + throw new SEDALibException( + "Création du lien et du raccourci [" + linkOnDiskPath + "] impossible", + e1 + ); } - } else - throw new SEDALibException("Création du lien [" + linkOnDiskPath + "] impossible\n->" + e.getMessage()); + } else throw new SEDALibException( + "Création du lien [" + linkOnDiskPath + "] impossible\n->" + e.getMessage() + ); } } @@ -466,21 +497,18 @@ private void exportLink(Path target, Path containerPath, String newLink) throws * @throws SEDALibException if writing has failed * @throws InterruptedException if interrupted */ - private void exportDataObjectRefList(DataObjectRefList dorl, Path auPath) throws SEDALibException, InterruptedException { - for (DataObject zdo : dorl.getDataObjectList()) - if (zdo instanceof DataObjectGroup) { - Path dogPath = dogPathStringMap.get(zdo); - if (dogPath == null) - exportDataObjectGroupContent((DataObjectGroup) zdo, auPath); - else if (dogPath == emptyPath) - dogPathStringMap.put((DataObjectGroup) zdo, exportDataObjectGroup((DataObjectGroup) zdo, auPath)); - - else - exportLink(dogPath, auPath, "##DataObjectGroup##"); - } else if (zdo instanceof BinaryDataObject) - exportBinaryDataObject((BinaryDataObject) zdo, auPath); - else if (zdo instanceof PhysicalDataObject) - exportPhysicalDataObject((PhysicalDataObject) zdo, auPath); + private void exportDataObjectRefList(DataObjectRefList dorl, Path auPath) + throws SEDALibException, InterruptedException { + for (DataObject zdo : dorl.getDataObjectList()) if (zdo instanceof DataObjectGroup) { + Path dogPath = dogPathStringMap.get(zdo); + if (dogPath == null) exportDataObjectGroupContent((DataObjectGroup) zdo, auPath); + else if (dogPath == emptyPath) dogPathStringMap.put( + (DataObjectGroup) zdo, + exportDataObjectGroup((DataObjectGroup) zdo, auPath) + ); + else exportLink(dogPath, auPath, "##DataObjectGroup##"); + } else if (zdo instanceof BinaryDataObject) exportBinaryDataObject((BinaryDataObject) zdo, auPath); + else if (zdo instanceof PhysicalDataObject) exportPhysicalDataObject((PhysicalDataObject) zdo, auPath); } /** @@ -494,41 +522,61 @@ else if (zdo instanceof PhysicalDataObject) private void exportArchiveUnit(ArchiveUnit au, Path containerPath) throws SEDALibException, InterruptedException { Path targetOnDiskPath, auPath; - if (auPathStringMap.containsKey(au)) - exportLink(auPathStringMap.get(au), containerPath, constructDirectoryName(au)); + if (auPathStringMap.containsKey(au)) exportLink( + auPathStringMap.get(au), + containerPath, + constructDirectoryName(au) + ); else { // create directory targetOnDiskPath = containerPath.resolve(constructDirectoryName(au)); try { Files.createDirectories(targetOnDiskPath); } catch (Exception e) { - throw new SEDALibException("Création du répertoire [" + targetOnDiskPath + "] pour l'ArchiveUnit [" - + au.getInDataObjectPackageId() + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Création du répertoire [" + + targetOnDiskPath + + "] pour l'ArchiveUnit [" + + au.getInDataObjectPackageId() + + "] impossible\n->" + + e.getMessage() + ); } auPath = targetOnDiskPath; // write metadata targetOnDiskPath = auPath.resolve("__ArchiveUnitMetadata.xml"); - if (filesPathSet.contains(targetOnDiskPath)) - throw new SEDALibException("Collision de fichiers de représentation [" + targetOnDiskPath.toString() - + "] détectée sur l'ArchiveUnit [" + au.getInDataObjectPackageId() + "]"); + if (filesPathSet.contains(targetOnDiskPath)) throw new SEDALibException( + "Collision de fichiers de représentation [" + + targetOnDiskPath.toString() + + "] détectée sur l'ArchiveUnit [" + + au.getInDataObjectPackageId() + + "]" + ); filesPathSet.add(targetOnDiskPath); try { Files.write(targetOnDiskPath, au.toSedaXmlFragments().getBytes(StandardCharsets.UTF_8)); } catch (Exception e) { - throw new SEDALibException("Ecriture des métadonnées de l'ArchiveUnit [" + au.getInDataObjectPackageId() - + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Ecriture des métadonnées de l'ArchiveUnit [" + + au.getInDataObjectPackageId() + + "] impossible\n->" + + e.getMessage() + ); } // write all DataObjects exportDataObjectRefList(au.getDataObjectRefList(), auPath); auPathStringMap.put(au, auPath); - for (ArchiveUnit childAu : au.getChildrenAuList().getArchiveUnitList()) - exportArchiveUnit(childAu, auPath); + for (ArchiveUnit childAu : au.getChildrenAuList().getArchiveUnitList()) exportArchiveUnit(childAu, auPath); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " ArchiveUnit exportées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " ArchiveUnit exportées" + ); } } @@ -553,15 +601,20 @@ public void doExport(String directoryName) throws SEDALibException, InterruptedE Files.createDirectories(exportPath); } catch (Exception e) { throw new SEDALibException( - "Création du répertoire d'export [" + exportPath + "] impossible\n->" + e.getMessage()); + "Création du répertoire d'export [" + exportPath + "] impossible\n->" + e.getMessage() + ); } dataObjectPackage.resetInOutCounter(); determineExplicitDataObjectGroupMap(); - if (dataObjectPackage.getManagementMetadataXmlData() != null) - exportManagementMetadata(dataObjectPackage.getManagementMetadataXmlData(), exportPath); - for (ArchiveUnit au : dataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList()) - exportArchiveUnit(au, exportPath); + if (dataObjectPackage.getManagementMetadataXmlData() != null) exportManagementMetadata( + dataObjectPackage.getManagementMetadataXmlData(), + exportPath + ); + for (ArchiveUnit au : dataObjectPackage + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList()) exportArchiveUnit(au, exportPath); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java index 1c298d5e..e4f818f0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/exporter/package-info.java @@ -38,4 +38,4 @@ /** * Package for tools exporting archive structure and metadata to disk hierarchy, and to SEDA packets SIP */ -package fr.gouv.vitam.tools.sedalib.inout.exporter; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.inout.exporter; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java index d700e4f3..dd9f220e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatter.java @@ -53,6 +53,7 @@ * It's a utility class for {@link CSVMetadataToDataObjectPackageImporter} to analyse header line, and then interpret other lines through the formatter. */ public class CSVMetadataFormatter { + /** * Utility class for metadata formatter. */ @@ -91,8 +92,8 @@ public String toString() { } } - private class ValueAttrMetadataTag { + boolean isValue; MetadataTag tag; @@ -117,7 +118,11 @@ public ValueAttrMetadataTag(boolean isValue, MetadataTag tag) { * The first columns header names. */ private static final List MANDATORY_TRAILING_HEADERS = Arrays.asList( - ID, FILE, PARENTID, PARENTFILE, OBJECTFILES + ID, + FILE, + PARENTID, + PARENTFILE, + OBJECTFILES ); private MetadataTag rootTag, contentTag, managementTag; private LinkedHashMap tagHeaderColumnMapping; @@ -132,7 +137,6 @@ public ValueAttrMetadataTag(boolean isValue, MetadataTag tag) { private int parentGUIDColumn; private boolean isOnlyFile; - private void analyseFirstColumns(String[] headerRow) throws SEDALibException { List firstsMandatoryHeadersFound = new ArrayList<>(); for (int i = 0; i < 4; i++) { @@ -149,41 +153,57 @@ private void analyseFirstColumns(String[] headerRow) throws SEDALibException { fileColumn = 0; objectfilesColumn = -1; parentGUIDColumn = -1; - } else if (numberOfMandatoryHeaderFound == 2 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTFILE))) { + } else if ( + numberOfMandatoryHeaderFound == 2 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTFILE)) + ) { isOnlyFile = false; guidColumn = firstsMandatoryHeadersFound.indexOf(FILE); fileColumn = guidColumn; objectfilesColumn = -1; parentGUIDColumn = firstsMandatoryHeadersFound.indexOf(PARENTFILE); - } else if (numberOfMandatoryHeaderFound == 3 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTFILE, ID))) { + } else if ( + numberOfMandatoryHeaderFound == 3 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTFILE, ID)) + ) { isOnlyFile = false; guidColumn = firstsMandatoryHeadersFound.indexOf(ID); fileColumn = firstsMandatoryHeadersFound.indexOf(FILE); objectfilesColumn = -1; parentGUIDColumn = firstsMandatoryHeadersFound.indexOf(PARENTFILE); - } else if (numberOfMandatoryHeaderFound == 3 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTID, ID))) { + } else if ( + numberOfMandatoryHeaderFound == 3 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, PARENTID, ID)) + ) { isOnlyFile = false; guidColumn = firstsMandatoryHeadersFound.indexOf(ID); fileColumn = firstsMandatoryHeadersFound.indexOf(FILE); objectfilesColumn = -1; parentGUIDColumn = firstsMandatoryHeadersFound.indexOf(PARENTID); - } else if (numberOfMandatoryHeaderFound == 3 && firstsMandatoryHeadersFound.containsAll(List.of(OBJECTFILES, PARENTID, ID))) { + } else if ( + numberOfMandatoryHeaderFound == 3 && + firstsMandatoryHeadersFound.containsAll(List.of(OBJECTFILES, PARENTID, ID)) + ) { isOnlyFile = false; guidColumn = firstsMandatoryHeadersFound.indexOf(ID); fileColumn = -1; objectfilesColumn = firstsMandatoryHeadersFound.indexOf(OBJECTFILES); parentGUIDColumn = firstsMandatoryHeadersFound.indexOf(PARENTID); - } else if (numberOfMandatoryHeaderFound == 4 && firstsMandatoryHeadersFound.containsAll(List.of(FILE, OBJECTFILES, PARENTID, ID))) { + } else if ( + numberOfMandatoryHeaderFound == 4 && + firstsMandatoryHeadersFound.containsAll(List.of(FILE, OBJECTFILES, PARENTID, ID)) + ) { isOnlyFile = false; guidColumn = firstsMandatoryHeadersFound.indexOf(ID); objectfilesColumn = firstsMandatoryHeadersFound.indexOf(OBJECTFILES); fileColumn = firstsMandatoryHeadersFound.indexOf(FILE); parentGUIDColumn = firstsMandatoryHeadersFound.indexOf(PARENTID); } else { - throw new SEDALibException("Le header [" + String.join("|", headerRow) + "] est mal formatté. Il doit contenir au début soit une colonne File, " + - "soit deux colonnes File et ParentFile, soit trois colonnes ID, File et ParentFile ou ID, File " + - ", soit quatre colonnes ID, ParentID, File, ObjectFiles " + - "et ParentID."); + throw new SEDALibException( + "Le header [" + + String.join("|", headerRow) + + "] est mal formatté. Il doit contenir au début soit une colonne File, " + + "soit deux colonnes File et ParentFile, soit trois colonnes ID, File et ParentFile ou ID, File " + + ", soit quatre colonnes ID, ParentID, File, ObjectFiles " + + "et ParentID." + ); } } @@ -250,7 +270,10 @@ private void analyseTags(String[] headerRow) throws SEDALibException { if (headerRow.length <= numberOfMandatoryHeaderFound) { throw new SEDALibException("Pas de colonne de métadonnées."); } - if (headerRow[numberOfMandatoryHeaderFound].startsWith("Content.") || headerRow[numberOfMandatoryHeaderFound].startsWith("Management.")) { + if ( + headerRow[numberOfMandatoryHeaderFound].startsWith("Content.") || + headerRow[numberOfMandatoryHeaderFound].startsWith("Management.") + ) { rootTag = new MetadataTag(null, null); contentTag = null; } else { @@ -294,10 +317,13 @@ public CSVMetadataFormatter(String[] headerRow, Path baseDir) throws SEDALibExce } private void resetValues() { - tagHeaderColumnMapping.values().stream().forEach(valueAttr -> { - valueAttr.tag.value = null; - valueAttr.tag.attr = null; - }); + tagHeaderColumnMapping + .values() + .stream() + .forEach(valueAttr -> { + valueAttr.tag.value = null; + valueAttr.tag.attr = null; + }); } private void defineColumnValue(int headerColumn, String cell) { @@ -375,28 +401,40 @@ private String generateHoldRuleTagXML(MetadataTag tag) throws SEDALibException { result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)).append(""); break; case "StartDate": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; case "HoldEndDate": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; case "HoldOwner": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; case "HoldReassessingDate": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; case "HoldReason": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; case "PreventRearrangement": - result.append("").append(HtmlAndXmlEscape.escapeXml(mt.value)) - .append(""); + result + .append("") + .append(HtmlAndXmlEscape.escapeXml(mt.value)) + .append(""); break; default: continue; @@ -479,13 +517,17 @@ private String generateTagXML(MetadataTag tag) throws SEDALibException { } } - if (value.isEmpty() - && ((tag.value == null) || tag.value.isEmpty()) - && ((tag.attr == null) || tag.attr.isEmpty())) { + if ( + value.isEmpty() && + ((tag.value == null) || tag.value.isEmpty()) && + ((tag.attr == null) || tag.attr.isEmpty()) + ) { return ""; } if (!value.isEmpty() && (tag.value != null) && !tag.value.isEmpty()) { - throw new SEDALibException("Il ne peut y avoir une valeur et des sous-éléments dans un élément SEDA [" + tag + "]."); + throw new SEDALibException( + "Il ne peut y avoir une valeur et des sous-éléments dans un élément SEDA [" + tag + "]." + ); } if (tag.name != null) { result = "<" + tag.name; @@ -536,7 +578,6 @@ public String extractManagementXML() throws SEDALibException { return generateTagXML(managementTag); } - /** * Gets guid. * diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java index 1692bdec..0a9a72c4 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataToDataObjectPackageImporter.java @@ -106,6 +106,7 @@ public class CSVMetadataToDataObjectPackageImporter { private class Line { + /** * The Guid. */ @@ -145,14 +146,19 @@ private class Line { * @param file the file * @param contentXMLMetadata the content xml metadata */ - public Line(String guid, String parentGUID, String file, String objectFiles, String contentXMLMetadata, String managementXMLMetadata) { + public Line( + String guid, + String parentGUID, + String file, + String objectFiles, + String contentXMLMetadata, + String managementXMLMetadata + ) { this.guid = guid; this.parentGUID = parentGUID; this.file = file; - if (objectFiles.trim().isEmpty()) - this.objectFiles = Arrays.asList(); - else - this.objectFiles = Arrays.asList(objectFiles.split("\\|")); + if (objectFiles.trim().isEmpty()) this.objectFiles = Arrays.asList(); + else this.objectFiles = Arrays.asList(objectFiles.split("\\|")); this.contentXMLMetadata = contentXMLMetadata; this.managementXMLMetadata = managementXMLMetadata; this.au = null; @@ -213,9 +219,17 @@ public Line(String guid, String parentGUID, String file, String objectFiles, Str * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if file doesn't exist */ - public CSVMetadataToDataObjectPackageImporter(String csvMetadataFileName, String encoding, char separator, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException { - if (!Files.isRegularFile(Paths.get(csvMetadataFileName), java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + csvMetadataFileName + "] pointant vers le fichier csv ne désigne pas un fichier"); + public CSVMetadataToDataObjectPackageImporter( + String csvMetadataFileName, + String encoding, + char separator, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { + if ( + !Files.isRegularFile(Paths.get(csvMetadataFileName), java.nio.file.LinkOption.NOFOLLOW_LINKS) + ) throw new SEDALibException( + "Le chemin [" + csvMetadataFileName + "] pointant vers le fichier csv ne désigne pas un fichier" + ); this.csvMetadataFileName = csvMetadataFileName; this.csvMetadataDirectoryPath = Paths.get(csvMetadataFileName).getParent(); @@ -240,39 +254,52 @@ private boolean readCSVFile() throws SEDALibException, InterruptedException { CsvMapper mapper = new CsvMapper(); CsvSchema schema = mapper.schemaFor(String[].class).withColumnSeparator(separator); mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY); - try (InputStreamReader isr = new InputStreamReader(new FileInputStream(csvMetadataFileName), encoding); - MappingIterator it = mapper.readerFor(String[].class).with(schema).readValues(isr)) { + try ( + InputStreamReader isr = new InputStreamReader(new FileInputStream(csvMetadataFileName), encoding); + MappingIterator it = mapper.readerFor(String[].class).with(schema).readValues(isr) + ) { while (it.hasNext()) { String[] row = it.next(); lineCount++; // jump header line if (lineCount == 1) { - metadataFormatter = new CSVMetadataFormatter(row, Paths.get(csvMetadataFileName).toAbsolutePath().getParent()); + metadataFormatter = new CSVMetadataFormatter( + row, + Paths.get(csvMetadataFileName).toAbsolutePath().getParent() + ); isExtendedFormat = metadataFormatter.isExtendedFormat(); continue; } try { - currentLine = new Line(metadataFormatter.getGUID(row), metadataFormatter.getParentGUID(row), //NOSONAR - metadataFormatter.getFile(row), metadataFormatter.getObjectFiles(row), metadataFormatter.doFormatAndExtractContentXML(row), metadataFormatter.extractManagementXML()); + currentLine = new Line( + metadataFormatter.getGUID(row), + metadataFormatter.getParentGUID(row), //NOSONAR + metadataFormatter.getFile(row), + metadataFormatter.getObjectFiles(row), + metadataFormatter.doFormatAndExtractContentXML(row), + metadataFormatter.extractManagementXML() + ); } catch (SEDALibException e) { - throw new SEDALibException("Erreur sur la ligne "+lineCount, e); + throw new SEDALibException("Erreur sur la ligne " + lineCount, e); } linesMap.put(metadataFormatter.getGUID(row), currentLine); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, lineCount, "sedalib: " + lineCount + " lignes interprétées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + lineCount, + "sedalib: " + lineCount + " lignes interprétées" + ); } } catch (IOException e) { throw new SEDALibException("Le fichier csv [" + csvMetadataFileName + "] n'est pas accessible"); } - if (metadataFormatter != null) - return metadataFormatter.needIdRegeneration(); - else //if file empty... - return false; + if (metadataFormatter != null) return metadataFormatter.needIdRegeneration(); + else return false; //if file empty... } private Path getAbsolutePath(String file) { Path path = Paths.get(file); - if (!path.isAbsolute()) - path = csvMetadataDirectoryPath.resolve(path); + if (!path.isAbsolute()) path = csvMetadataDirectoryPath.resolve(path); return path; } @@ -296,39 +323,64 @@ private ArchiveUnit createLineAU(Line line) throws SEDALibException, Interrupted for (String objectFile : line.objectFiles) { Path objectPath = getAbsolutePath(objectFile); if (!Files.isRegularFile(objectPath)) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - "sedalib: la référence sur le disque du fichier objet [" + objectFile + "] n'est plus valable", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: la référence sur le disque du fichier objet [" + objectFile + "] n'est plus valable", + null + ); continue; } String fileName = path.getFileName().toString(); - if ((objectFile.matches("__\\w+__.+")) || (objectFile.matches("__\\w+_.+"))) - implicitDog = DiskToDataObjectPackageImporter.addBinaryDataObject(dataObjectPackage, objectPath, fileName, au, implicitDog); + if ((objectFile.matches("__\\w+__.+")) || (objectFile.matches("__\\w+_.+"))) implicitDog = + DiskToDataObjectPackageImporter.addBinaryDataObject( + dataObjectPackage, + objectPath, + fileName, + au, + implicitDog + ); else { - bdo = new BinaryDataObject(dataObjectPackage, objectPath, path.getFileName().toString(), - "BinaryMaster_1"); + bdo = new BinaryDataObject( + dataObjectPackage, + objectPath, + path.getFileName().toString(), + "BinaryMaster_1" + ); au.addDataObjectById(bdo.getInDataObjectPackageId()); } } } else { if (Files.isRegularFile(path)) { - bdo = new BinaryDataObject(dataObjectPackage, path, path.getFileName().toString(), - "BinaryMaster_1"); + bdo = new BinaryDataObject(dataObjectPackage, path, path.getFileName().toString(), "BinaryMaster_1"); au.addDataObjectById(bdo.getInDataObjectPackageId()); } else if (Files.isDirectory(path)) { try (DirectoryStream stream = Files.newDirectoryStream(path)) { for (Path subPath : stream) { if (Files.isRegularFile(subPath)) { String fileName = path.getFileName().toString(); - if ((fileName.matches("__\\w+__.+")) || (fileName.matches("__\\w+_.+"))) - implicitDog = DiskToDataObjectPackageImporter.addBinaryDataObject(dataObjectPackage, path, fileName, au, implicitDog); + if ((fileName.matches("__\\w+__.+")) || (fileName.matches("__\\w+_.+"))) implicitDog = + DiskToDataObjectPackageImporter.addBinaryDataObject( + dataObjectPackage, + path, + fileName, + au, + implicitDog + ); } } } catch (IOException e) { - throw new SEDALibException("Les fichiers dans le répertoire [" + path + "] ne sont pas accessibles"); + throw new SEDALibException( + "Les fichiers dans le répertoire [" + path + "] ne sont pas accessibles" + ); } } else if (!line.file.isEmpty()) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - "sedalib: la référence sur le disque de l'archiveUnit [" + line.guid + "] n'est plus valable", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: la référence sur le disque de l'archiveUnit [" + line.guid + "] n'est plus valable", + null + ); } } return au; @@ -339,8 +391,12 @@ private ArchiveUnit createToRoot(Line line) throws SEDALibException, Interrupted line.au = createLineAU(line); Line parentLine = linesMap.get(line.parentGUID); if ((parentLine == null) || parentLine.equals(line)) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - "sedalib: archiveUnit [" + line.guid + "] n'a pas de parent, elle est mise en racine", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + "sedalib: archiveUnit [" + line.guid + "] n'a pas de parent, elle est mise en racine", + null + ); dataObjectPackage.addRootAu(line.au); } else { ArchiveUnit parentAU = createToRoot(parentLine); @@ -371,36 +427,60 @@ public void doImport() throws SEDALibException, InterruptedException { String log = "sedalib: début de l'import du fichier csv de métadonnées\n"; log += "en [" + csvMetadataFileName + "]\n"; log += "date=" + DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); boolean needIdRegeneration = readCSVFile(); dataObjectPackage = new DataObjectPackage(); - int lineCount=0; + int lineCount = 0; for (Map.Entry e : linesMap.entrySet()) { if (e.getValue().au != null) continue; createToRoot(e.getValue()); lineCount++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, lineCount, "sedalib: " + lineCount + " ArchiveUnits importées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + lineCount, + "sedalib: " + lineCount + " ArchiveUnits importées" + ); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: " + lineCount + " ArchiveUnits importées", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + lineCount + " ArchiveUnits importées", + null + ); dataObjectPackage.vitamNormalize(sedaLibProgressLogger); - if (needIdRegeneration) - dataObjectPackage.regenerateContinuousIds(); + if (needIdRegeneration) dataObjectPackage.regenerateContinuousIds(); lineCount = 0; for (Map.Entry pair : dataObjectPackage.getBdoInDataObjectPackageIdMap().entrySet()) { - FileInfo fileInfo= pair.getValue().getMetadataFileInfo(); - if (fileInfo.getSimpleMetadata("LastModified") == null) - pair.getValue().extractTechnicalElements(sedaLibProgressLogger); + FileInfo fileInfo = pair.getValue().getMetadataFileInfo(); + if (fileInfo.getSimpleMetadata("LastModified") == null) pair + .getValue() + .extractTechnicalElements(sedaLibProgressLogger); lineCount++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, lineCount, "sedalib: " + lineCount + - " fichiers BinaryDataObject analysés"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + lineCount, + "sedalib: " + lineCount + " fichiers BinaryDataObject analysés" + ); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: " + lineCount + " fichiers BinaryDataObject analysés et importés dans le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + lineCount + " fichiers BinaryDataObject analysés et importés dans le DataObjectPackage", + null + ); end = Instant.now(); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: import du fichier csv de métadonnées terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: import du fichier csv de métadonnées terminé", + null + ); } /** @@ -421,9 +501,7 @@ public String getSummary() { String result; result = dataObjectPackage.getDescription() + "\n"; - if (start != null) - result += "chargé en " - + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java index 420cc2e0..24d3ceb1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVTreeToDataObjectPackageImporter.java @@ -110,6 +110,7 @@ public class CSVTreeToDataObjectPackageImporter { * Utility class for csv line encoding. */ private class Line { + String uniqId; String title; String description; @@ -144,12 +145,18 @@ protected Line(String uniqId, String title, String description, String suffix, S * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if file doesn't exist */ - public CSVTreeToDataObjectPackageImporter(String csvFileName, String encoding, char separator, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException { + public CSVTreeToDataObjectPackageImporter( + String csvFileName, + String encoding, + char separator, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { Path pathFile; pathFile = Paths.get(csvFileName); - if (!Files.isRegularFile(pathFile, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + csvFileName + "] pointant vers le fichier csv ne désigne pas un fichier"); + if (!Files.isRegularFile(pathFile, java.nio.file.LinkOption.NOFOLLOW_LINKS)) throw new SEDALibException( + "Le chemin [" + csvFileName + "] pointant vers le fichier csv ne désigne pas un fichier" + ); this.csvFileName = csvFileName; this.sedaLibProgressLogger = sedaLibProgressLogger; @@ -172,27 +179,35 @@ private void readCSVFile() throws SEDALibException, InterruptedException { CsvMapper mapper = new CsvMapper(); CsvSchema schema = mapper.schemaFor(String[].class).withColumnSeparator(separator); mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY); - try (InputStreamReader isr = new InputStreamReader(new FileInputStream(csvFileName), encoding); - MappingIterator it = mapper.readerFor(String[].class).with(schema).readValues(isr)) { + try ( + InputStreamReader isr = new InputStreamReader(new FileInputStream(csvFileName), encoding); + MappingIterator it = mapper.readerFor(String[].class).with(schema).readValues(isr) + ) { while (it.hasNext()) { String[] row = it.next(); lineCount++; // jump header line - if (lineCount == 1) - continue; - if (row.length < 5) - throw new SEDALibException("La ligne " + lineCount + " ne contient pas le nombre minimum de champs attendus (5)"); + if (lineCount == 1) continue; + if (row.length < 5) throw new SEDALibException( + "La ligne " + lineCount + " ne contient pas le nombre minimum de champs attendus (5)" + ); line = new Line(row[0], row[1], row[2], row[3], row[4]); - if (line.title.isEmpty()) - throw new SEDALibException("Le titre de la ligne " + lineCount + " ne doit pas être vide"); - if (line.suffix.isEmpty()) - throw new SEDALibException("Le suffixe de la ligne " + lineCount + " ne doit pas être vide"); + if (line.title.isEmpty()) throw new SEDALibException( + "Le titre de la ligne " + lineCount + " ne doit pas être vide" + ); + if (line.suffix.isEmpty()) throw new SEDALibException( + "Le suffixe de la ligne " + lineCount + " ne doit pas être vide" + ); List value = linesMap.get(line.motherId); - if (value == null) - value = new ArrayList<>(); + if (value == null) value = new ArrayList<>(); value.add(line); linesMap.put(line.motherId, value); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, lineCount, "sedalib: " + lineCount + " lignes interprétées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + lineCount, + "sedalib: " + lineCount + " lignes interprétées" + ); } } catch (IOException e) { throw new SEDALibException("Le fichier csv [" + csvFileName + "] n'est pas accessible"); @@ -207,28 +222,28 @@ private ArchiveUnit addLineAndChildren(Line line) throws InterruptedException { content = new Content(); try { content.addNewMetadata("Title", line.title); - if (!line.description.isEmpty()) - content.addNewMetadata("Description", line.description); - if (line.motherId.isEmpty()) - content.addNewMetadata("DescriptionLevel", "Series"); - else - content.addNewMetadata("DescriptionLevel", "Subseries"); + if (!line.description.isEmpty()) content.addNewMetadata("Description", line.description); + if (line.motherId.isEmpty()) content.addNewMetadata("DescriptionLevel", "Series"); + else content.addNewMetadata("DescriptionLevel", "Subseries"); content.addNewMetadata("OriginatingAgencyArchiveUnitIdentifier", line.motherId + line.suffix); } catch (Exception ignored) { //ignored } au.setContent(content); List childLines = linesMap.get(line.motherId + line.suffix); - if (childLines != null) - for (Line childLine : linesMap.get(line.motherId + line.suffix)) { - ArchiveUnit childAu = addLineAndChildren(childLine); - au.addChildArchiveUnit(childAu); - } + if (childLines != null) for (Line childLine : linesMap.get(line.motherId + line.suffix)) { + ArchiveUnit childAu = addLineAndChildren(childLine); + au.addChildArchiveUnit(childAu); + } linesMap.remove(line.motherId + line.suffix); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger,SEDALibProgressLogger.OBJECTS_GROUP, counter, - "sedalib: " + counter + " ArchiveUnit exportées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " ArchiveUnit exportées" + ); return au; } @@ -244,15 +259,16 @@ public void doImport() throws SEDALibException, InterruptedException { String log = "sedalib: début de l'import du fichier csv d'arbre de plan de classement\n"; log += "en [" + csvFileName + "]\n"; log += "date=" + DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); readCSVFile(); dataObjectPackage = new DataObjectPackage(); dataObjectPackage.resetInOutCounter(); List rootLines = linesMap.get(""); - if (rootLines == null) - throw new SEDALibException("Le fichier csv ne contient pas de ligne décrivant de série (champ série vide)"); + if (rootLines == null) throw new SEDALibException( + "Le fichier csv ne contient pas de ligne décrivant de série (champ série vide)" + ); for (Line rootLine : rootLines) { ArchiveUnit rootAu = addLineAndChildren(rootLine); @@ -263,15 +279,19 @@ public void doImport() throws SEDALibException, InterruptedException { String error = "Les lignes ayant les identifiants suivant n'appartiennent pas à une série ["; Iterator it = linesMap.keySet().iterator(); while (it.hasNext()) { - for (Line line : linesMap.get(it.next())) - error += line.uniqId + ", "; + for (Line line : linesMap.get(it.next())) error += line.uniqId + ", "; } error = error.substring(0, error.length() - 2) + "]"; throw new SEDALibException(error); } end = Instant.now(); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: import du fichier csv d'arbre de plan de classement terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: import du fichier csv d'arbre de plan de classement terminé", + null + ); } /** @@ -292,10 +312,7 @@ public String getSummary() { String result; result = dataObjectPackage.getDescription() + "\n"; - if (start != null) - result += "chargé en " - + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java index 06fbd24a..068f0283 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/CompressedFileToArchiveTransferImporter.java @@ -84,6 +84,7 @@ public class CompressedFileToArchiveTransferImporter { * Wrap org.apache.commons.compress SevenZFile to have same ArchiveInputStream behavior */ private static class SevenZWrapper extends ArchiveInputStream { + private SevenZFile file; private SevenZWrapper(SevenZFile file) { @@ -224,8 +225,7 @@ public static boolean isKnownCompressedDroidFormat(String droidFormat) { return false; } - private ArchiveInputStream createArchiveInputStream() - throws SEDALibException { + private ArchiveInputStream createArchiveInputStream() throws SEDALibException { Path onDiskPath = null; FileInputStream fis = null; ArchiveInputStream ais; @@ -263,14 +263,12 @@ private ArchiveInputStream createArchiveInputStream() //ignore } } - throw new SEDALibException("Impossible d'ouvrir le fichier compressé [" - + onDiskPath.toString() + "]", e); + throw new SEDALibException("Impossible d'ouvrir le fichier compressé [" + onDiskPath.toString() + "]", e); } return ais; } - private void unCompressContainer() - throws SEDALibException, InterruptedException { + private void unCompressContainer() throws SEDALibException, InterruptedException { int counter = 0; try (final ArchiveInputStream archiveInputStream = createArchiveInputStream()) { @@ -281,8 +279,14 @@ private void unCompressContainer() String entryName = entry.getName(); if (entryName.contains("?")) { entryName = entryName.replace("?", "_"); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, - "Le nom du fichier [" + entryName + "] a un problème d'encodage, le(s) caractère(s) problématique à été rempalcé par _ ", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "Le nom du fichier [" + + entryName + + "] a un problème d'encodage, le(s) caractère(s) problématique à été rempalcé par _ ", + null + ); } final Path target = Paths.get(unCompressDirectory, entryName); final Path parent = target.getParent(); @@ -291,13 +295,20 @@ private void unCompressContainer() Files.createDirectories(parent); } if (!entry.isDirectory()) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, - "Décompresse le fichier [" + entryName + "]", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "Décompresse le fichier [" + entryName + "]", + null + ); Files.copy(archiveInputStream, target, StandardCopyOption.REPLACE_EXISTING); counter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - Integer.toString(counter) + - " fichiers extraits"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + Integer.toString(counter) + " fichiers extraits" + ); } else if (!Files.exists(target)) { Files.createDirectories(target); } @@ -319,9 +330,13 @@ private void unCompressContainer() * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if file or directory doesn't exist */ - public CompressedFileToArchiveTransferImporter(String compressedFile, String unCompressDirectory, String encoding, - Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException { + public CompressedFileToArchiveTransferImporter( + String compressedFile, + String unCompressDirectory, + String encoding, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { Path compressedFilePath; Path unCompressDirectoryPath; @@ -337,18 +352,23 @@ public CompressedFileToArchiveTransferImporter(String compressedFile, String unC this.onDiskRootPaths = new ArrayList<>(); compressedFilePath = Paths.get(compressedFile); - if (!Files.isRegularFile(compressedFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + compressedFile + "] pointant vers le fichier compressé ne désigne pas un fichier"); + if ( + !Files.isRegularFile(compressedFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS) + ) throw new SEDALibException( + "Le chemin [" + compressedFile + "] pointant vers le fichier compressé ne désigne pas un fichier" + ); unCompressDirectoryPath = Paths.get(unCompressDirectory).toAbsolutePath(); this.unCompressDirectory = unCompressDirectoryPath.normalize().toString(); - if (!Files.exists(unCompressDirectoryPath)) - try { - Files.createDirectories(unCompressDirectoryPath); - } catch (IOException e) { - throw new SEDALibException("Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]"); - } - if (!Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire"); + if (!Files.exists(unCompressDirectoryPath)) try { + Files.createDirectories(unCompressDirectoryPath); + } catch (IOException e) { + throw new SEDALibException("Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]"); + } + if ( + !Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS) + ) throw new SEDALibException( + "Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire" + ); } /** @@ -360,7 +380,6 @@ public void addIgnorePattern(String patternString) { ignorePatternStrings.add(patternString); } - /** * Process the GlobalMetadata file. * @@ -373,8 +392,10 @@ private GlobalMetadata processGlobalMetadata(Path path) throws SEDALibException try { atgm.fromSedaXmlFragments(new String(Files.readAllBytes(path), StandardCharsets.UTF_8)); } catch (SEDALibException | IOException e) { - throw new SEDALibException("Lecture des métadonnées globales à partir du fichier [" + path - + "] impossible", e); + throw new SEDALibException( + "Lecture des métadonnées globales à partir du fichier [" + path + "] impossible", + e + ); } return atgm; } @@ -402,10 +423,8 @@ public void doImport() throws SEDALibException, InterruptedException { // determine encoding from the compressed format if (encoding == null) { - if (ZIP.equals(droidFormat)) - encoding = "CP850"; - else - encoding = "UTF8"; + if (ZIP.equals(droidFormat)) encoding = "CP850"; + else encoding = "UTF8"; } unCompressContainer(); @@ -415,30 +434,40 @@ public void doImport() throws SEDALibException, InterruptedException { pi = sp.iterator(); while (pi.hasNext()) { path = pi.next(); - if (path.getFileName().toString().equals("__GlobalMetadata.xml")) - this.onDiskGlobalMetadataPath = path; - else - this.onDiskRootPaths.add(path); + if (path.getFileName().toString().equals("__GlobalMetadata.xml")) this.onDiskGlobalMetadataPath = path; + else this.onDiskRootPaths.add(path); } } catch (IOException e) { throw new SEDALibException( - "Impossible de lister les fichiers du répertoire [" + unCompressDirectory + "]", e); + "Impossible de lister les fichiers du répertoire [" + unCompressDirectory + "]", + e + ); } - this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter(this.onDiskRootPaths, true, - extractTitleFromFileNameFunction, - sedaLibProgressLogger); + this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter( + this.onDiskRootPaths, + true, + extractTitleFromFileNameFunction, + sedaLibProgressLogger + ); this.archiveTransfer = new ArchiveTransfer(); - if (onDiskGlobalMetadataPath != null) - archiveTransfer.setGlobalMetadata(processGlobalMetadata(onDiskGlobalMetadataPath)); - for (String patternString : ignorePatternStrings) - diskToDataObjectPackageImporter.addIgnorePattern(patternString); + if (onDiskGlobalMetadataPath != null) archiveTransfer.setGlobalMetadata( + processGlobalMetadata(onDiskGlobalMetadataPath) + ); + for (String patternString : ignorePatternStrings) diskToDataObjectPackageImporter.addIgnorePattern( + patternString + ); diskToDataObjectPackageImporter.doImport(); archiveTransfer.setDataObjectPackage(diskToDataObjectPackageImporter.getDataObjectPackage()); end = Instant.now(); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: import d'un ArchiveTransfer depuis un fichier compressé sur disque terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: import d'un ArchiveTransfer depuis un fichier compressé sur disque terminé", + null + ); } /** @@ -459,11 +488,8 @@ public String getSummary() { String result = null; if (archiveTransfer != null) { result = archiveTransfer.getDescription() + "\n"; - if (start != null) - result += "chargé en " - + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; } return result; } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java index c550e6cb..e6216859 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DIPToArchiveDeliveryRequestReplyImporter.java @@ -108,8 +108,10 @@ public class DIPToArchiveDeliveryRequestReplyImporter { public String unZipDip(String zipFile, String outputFolder) throws SEDALibException, InterruptedException { String manifest = null; int counter = 0; - try (FileInputStream fis = new FileInputStream(zipFile); - ZipArchiveInputStream zais = new ZipArchiveInputStream(fis)) { + try ( + FileInputStream fis = new FileInputStream(zipFile); + ZipArchiveInputStream zais = new ZipArchiveInputStream(fis) + ) { // create output directory is not exists File folder = new File(outputFolder); if (!folder.exists()) { @@ -122,44 +124,60 @@ public String unZipDip(String zipFile, String outputFolder) throws SEDALibExcept String fileName = ze.getName().trim(); // change any case ConTenT to lowercase content on import as in fromSEDA in // BinaryDataObject - if (fileName.toLowerCase().startsWith("content")) - fileName = "content" + fileName.substring(7); + if (fileName.toLowerCase().startsWith("content")) fileName = "content" + fileName.substring(7); Path newPath = Paths.get(outputFolder + File.separator + fileName); if (fileName.endsWith("/")) { - if (!Files.exists(newPath)) - Files.createDirectories(newPath); + if (!Files.exists(newPath)) Files.createDirectories(newPath); } else { if (fileName.toLowerCase().matches("[^/\\\\]*manifest.*\\.xml")) { - if (manifest != null) - throw new SEDALibException("DIP mal formé, plusieurs fichiers manifest potentiels"); + if (manifest != null) throw new SEDALibException( + "DIP mal formé, plusieurs fichiers manifest potentiels" + ); manifest = fileName; - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: unzip manifest [" + zipFile + "]", null); - } else - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: unzip fichier [" + zipFile + "]", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: unzip manifest [" + zipFile + "]", + null + ); + } else doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: unzip fichier [" + zipFile + "]", + null + ); // create all non exists folders // else you will hit FileNotFoundException for compressed folder - if (!Files.exists(newPath.getParent())) - Files.createDirectories(newPath.getParent()); + if (!Files.exists(newPath.getParent())) Files.createDirectories(newPath.getParent()); try (FileOutputStream fos = new FileOutputStream(newPath.toFile())) { IOUtils.copy(zais, fos); counter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, "sedalib: " + counter + " fichiers " + - "extraits"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " fichiers " + "extraits" + ); } } } } catch (IOException ex) { - throw new SEDALibException("Impossible de décompresser le fichier [" + zipFile + "] dans le répertoire [" - + outputFolder + "]", ex); + throw new SEDALibException( + "Impossible de décompresser le fichier [" + zipFile + "] dans le répertoire [" + outputFolder + "]", + ex + ); } - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.STEP, counter, "sedalib: " + counter + " fichiers " + - "extraits"); - if (manifest == null) - throw new SEDALibException("DIP mal formé, pas de manifest"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + counter, + "sedalib: " + counter + " fichiers " + "extraits" + ); + if (manifest == null) throw new SEDALibException("DIP mal formé, pas de manifest"); return manifest; } @@ -171,23 +189,31 @@ public String unZipDip(String zipFile, String outputFolder) throws SEDALibExcept * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if file or directory doesn't exist */ - public DIPToArchiveDeliveryRequestReplyImporter(String zipFile, String unCompressDirectory, - SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException { + public DIPToArchiveDeliveryRequestReplyImporter( + String zipFile, + String unCompressDirectory, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { Path zipFilePath, unCompressDirectoryPath; zipFilePath = Paths.get(zipFile); - if (!Files.isRegularFile(zipFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + zipFile + "] pointant vers le DIP ne désigne pas un fichier"); + if (!Files.isRegularFile(zipFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) throw new SEDALibException( + "Le chemin [" + zipFile + "] pointant vers le DIP ne désigne pas un fichier" + ); unCompressDirectoryPath = Paths.get(unCompressDirectory); - if (!Files.exists(unCompressDirectoryPath)) - try { - Files.createDirectories(unCompressDirectoryPath); - } catch (IOException e) { - throw new SEDALibException("Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]", e); - } - if (!Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) + if (!Files.exists(unCompressDirectoryPath)) try { + Files.createDirectories(unCompressDirectoryPath); + } catch (IOException e) { throw new SEDALibException( - "Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire"); + "Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]", + e + ); + } + if ( + !Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS) + ) throw new SEDALibException( + "Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire" + ); this.zipFile = zipFile; this.unCompressDirectory = unCompressDirectory; @@ -209,21 +235,25 @@ public void doImport() throws SEDALibException, InterruptedException { String log = "sedalib: début de l'import du DIP\n"; log += "en [" + zipFile + "]\n"; log += "date=" + DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); manifest = unZipDip(zipFile, unCompressDirectory); - try (FileInputStream fis = new FileInputStream(unCompressDirectory + File.separator + manifest); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(fis)) { - archiveDeliveryRequestReply = ArchiveDeliveryRequestReply.fromSedaXml(xmlReader, unCompressDirectory, - sedaLibProgressLogger); + try ( + FileInputStream fis = new FileInputStream(unCompressDirectory + File.separator + manifest); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(fis) + ) { + archiveDeliveryRequestReply = ArchiveDeliveryRequestReply.fromSedaXml( + xmlReader, + unCompressDirectory, + sedaLibProgressLogger + ); } catch (XMLStreamException | IOException e) { - throw new SEDALibException( - "Impossible d'importer le fichier [" + manifest + "] comme manifest du DIP", e); + throw new SEDALibException("Impossible d'importer le fichier [" + manifest + "] comme manifest du DIP", e); } end = Instant.now(); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: import du DIP terminé", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: import du DIP terminé", null); } /** @@ -244,8 +274,7 @@ public String getSummary() { String result; result = archiveDeliveryRequestReply.getDescription() + "\n"; - if (start != null) - result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java index 65504e72..6361e24a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToArchiveTransferImporter.java @@ -119,7 +119,7 @@ public class DiskToArchiveTransferImporter { * @throws SEDALibException if not a directory */ public DiskToArchiveTransferImporter(String directory, SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException { + throws SEDALibException { this(directory, false, simpleCopy, sedaLibProgressLogger); } @@ -141,10 +141,12 @@ public DiskToArchiveTransferImporter(String directory, SEDALibProgressLogger sed * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if not a directory */ - public DiskToArchiveTransferImporter(String directory, boolean noLinkFlag, - Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException { + public DiskToArchiveTransferImporter( + String directory, + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { Path path; Iterator pi; @@ -154,25 +156,26 @@ public DiskToArchiveTransferImporter(String directory, boolean noLinkFlag, this.onDiskRootPaths = new ArrayList<>(); path = Paths.get(directory); - if (!Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("[" + directory + "] n'est pas un répertoire"); + if (!Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) throw new SEDALibException( + "[" + directory + "] n'est pas un répertoire" + ); try (Stream sp = Files.list(path).sorted(Comparator.comparing(Path::getFileName))) { pi = sp.iterator(); while (pi.hasNext()) { path = pi.next(); - if (path.getFileName().toString().equals("__GlobalMetadata.xml")) - this.onDiskGlobalMetadataPath = path; - else - this.onDiskRootPaths.add(path); + if (path.getFileName().toString().equals("__GlobalMetadata.xml")) this.onDiskGlobalMetadataPath = path; + else this.onDiskRootPaths.add(path); } } catch (IOException e) { - throw new SEDALibException( - "Impossible de lister les fichiers du répertoire [" + directory + "]", e); + throw new SEDALibException("Impossible de lister les fichiers du répertoire [" + directory + "]", e); } - this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter(this.onDiskRootPaths, noLinkFlag, - extractTitleFromFileNameFunction, - sedaLibProgressLogger); + this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter( + this.onDiskRootPaths, + noLinkFlag, + extractTitleFromFileNameFunction, + sedaLibProgressLogger + ); } /** @@ -205,25 +208,28 @@ public DiskToArchiveTransferImporter(List paths, SEDALibProgressLogger sed * @param extractTitleFromFileNameFunction the extract title from file name function * @param sedaLibProgressLogger the progress logger or null if no progress log expected */ - public DiskToArchiveTransferImporter(List paths, boolean noLinkFlag, - Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) { - + public DiskToArchiveTransferImporter( + List paths, + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) { this.onDiskGlobalMetadataPath = null; this.archiveTransfer = new ArchiveTransfer(); this.sedaLibProgressLogger = sedaLibProgressLogger; this.onDiskRootPaths = new ArrayList<>(); for (Path path : paths) { - if (path.getFileName().toString().equals("__GlobalMetadata")) - this.onDiskGlobalMetadataPath = path; - else - this.onDiskRootPaths.add(path); + if (path.getFileName().toString().equals("__GlobalMetadata")) this.onDiskGlobalMetadataPath = path; + else this.onDiskRootPaths.add(path); } - this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter(this.onDiskRootPaths, noLinkFlag, - extractTitleFromFileNameFunction, - sedaLibProgressLogger); + this.diskToDataObjectPackageImporter = new DiskToDataObjectPackageImporter( + this.onDiskRootPaths, + noLinkFlag, + extractTitleFromFileNameFunction, + sedaLibProgressLogger + ); } /** @@ -247,8 +253,9 @@ private GlobalMetadata processGlobalMetadata(Path path) throws SEDALibException try { atgm.fromSedaXmlFragments(new String(Files.readAllBytes(path), StandardCharsets.UTF_8)); } catch (SEDALibException | IOException e) { - throw new SEDALibException("Lecture des métadonnées globales à partir du fichier [" + path - + "] impossible\n->" + e.getMessage()); + throw new SEDALibException( + "Lecture des métadonnées globales à partir du fichier [" + path + "] impossible\n->" + e.getMessage() + ); } return atgm; } @@ -269,7 +276,6 @@ private GlobalMetadata processGlobalMetadata(Path path) throws SEDALibException * @throws InterruptedException if export process is interrupted */ public void doImport() throws SEDALibException, InterruptedException { - Date d = new Date(); start = Instant.now(); String log = "sedalib: début de l'import d'un ArchiveTransfer depuis une hiérarchie sur disque\n"; @@ -277,10 +283,8 @@ public void doImport() throws SEDALibException, InterruptedException { boolean first = true; for (Path path : onDiskRootPaths) { if (!path.getFileName().toString().equals("__ManagementMetadata.xml")) { - if (first) - first = false; - else - log += ",\n"; + if (first) first = false; + else log += ",\n"; log += path.toString(); } } @@ -288,13 +292,19 @@ public void doImport() throws SEDALibException, InterruptedException { log += "date=" + DateFormat.getDateTimeInstance().format(d); doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); - if (onDiskGlobalMetadataPath != null) - archiveTransfer.setGlobalMetadata(processGlobalMetadata(onDiskGlobalMetadataPath)); + if (onDiskGlobalMetadataPath != null) archiveTransfer.setGlobalMetadata( + processGlobalMetadata(onDiskGlobalMetadataPath) + ); diskToDataObjectPackageImporter.doImport(); archiveTransfer.setDataObjectPackage(diskToDataObjectPackageImporter.getDataObjectPackage()); end = Instant.now(); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: import d'un ArchiveTransfer depuis une hiérarchie sur disque terminé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "sedalib: import d'un ArchiveTransfer depuis une hiérarchie sur disque terminé", + null + ); } /** @@ -336,8 +346,8 @@ public String getSummary() { result += "encodé selon un modèle hybride V1/V2 de la structure\n"; break; } - if ((start != null) && (end != null)) - result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; + if ((start != null) && (end != null)) result += + "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java index 02af6e9a..ee57e205 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/DiskToDataObjectPackageImporter.java @@ -227,8 +227,11 @@ public class DiskToDataObjectPackageImporter { */ private SEDALibProgressLogger sedaLibProgressLogger; - private DiskToDataObjectPackageImporter(boolean noLinkFlag, Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) { + private DiskToDataObjectPackageImporter( + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) { this.onDiskRootPaths = new ArrayList<>(); this.dataObjectPackage = null; ignorePatterns = new ArrayList<>(); @@ -237,10 +240,9 @@ private DiskToDataObjectPackageImporter(boolean noLinkFlag, Function(); this.modelVersion = 0; this.noLinkFlag = noLinkFlag; - if (extractTitleFromFileNameFunction != null) - this.extractTitleFromFileNameFunction = extractTitleFromFileNameFunction; - else - this.extractTitleFromFileNameFunction = simpleCopy; + if (extractTitleFromFileNameFunction != null) this.extractTitleFromFileNameFunction = + extractTitleFromFileNameFunction; + else this.extractTitleFromFileNameFunction = simpleCopy; this.inCounter = 0; this.sedaLibProgressLogger = sedaLibProgressLogger; @@ -264,24 +266,25 @@ private DiskToDataObjectPackageImporter(boolean noLinkFlag, Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) - throws SEDALibException { + public DiskToDataObjectPackageImporter( + String directory, + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { this(noLinkFlag, extractTitleFromFileNameFunction, sedaLibProgressLogger); Path path; Iterator pi; path = Paths.get(directory).toAbsolutePath(); - if (!Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("[" + directory + "] n'est pas un répertoire"); + if (!Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) throw new SEDALibException( + "[" + directory + "] n'est pas un répertoire" + ); try (Stream sp = Files.list(path).sorted(Comparator.comparing(Path::getFileName))) { pi = sp.iterator(); - while (pi.hasNext()) - this.onDiskRootPaths.add(pi.next()); + while (pi.hasNext()) this.onDiskRootPaths.add(pi.next()); } catch (IOException e) { - throw new SEDALibException( - "Impossible de lister les fichiers du répertoire [" + directory + "]", e); + throw new SEDALibException("Impossible de lister les fichiers du répertoire [" + directory + "]", e); } dataObjectPackage = new DataObjectPackage(); } @@ -316,9 +319,12 @@ public DiskToDataObjectPackageImporter(List paths, SEDALibProgressLogger s * @param extractTitleFromFileNameFunction the extract title from file name function * @param sedaLibProgressLogger the progress logger or null if no progress log expected */ - public DiskToDataObjectPackageImporter(List paths, boolean noLinkFlag, - Function extractTitleFromFileNameFunction, - SEDALibProgressLogger sedaLibProgressLogger) { + public DiskToDataObjectPackageImporter( + List paths, + boolean noLinkFlag, + Function extractTitleFromFileNameFunction, + SEDALibProgressLogger sedaLibProgressLogger + ) { this(noLinkFlag, extractTitleFromFileNameFunction, sedaLibProgressLogger); this.onDiskRootPaths = paths; dataObjectPackage = new DataObjectPackage(); @@ -333,7 +339,6 @@ public void addIgnorePattern(String patternString) { ignorePatterns.add(Pattern.compile(patternString)); } - /** * Test if a file name is compliant to one of ignore patterns. * @@ -365,8 +370,7 @@ private boolean analyzeLink(Path path) { if (Files.isSymbolicLink(path)) { lastAnalyzedLinkTarget = path.toRealPath(); return true; - } else if (Files.isRegularFile(path) - && path.getFileName().toString().toLowerCase().endsWith(".lnk")) { + } else if (Files.isRegularFile(path) && path.getFileName().toString().toLowerCase().endsWith(".lnk")) { WindowsShortcut ws = new WindowsShortcut(path.toFile()); lastAnalyzedLinkTarget = Paths.get(ws.getRealFilename()); return true; @@ -385,8 +389,11 @@ private boolean analyzeLink(Path path) { * @return true, if is data object group directory */ public static boolean isDataObjectGroupDirectory(Path path) { - return Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS) - && path.getFileName().toString().startsWith("##") && path.getFileName().toString().endsWith("##"); + return ( + Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS) && + path.getFileName().toString().startsWith("##") && + path.getFileName().toString().endsWith("##") + ); } /** @@ -399,13 +406,17 @@ public static boolean isDataObjectGroupDirectory(Path path) { private String processManagementMetadata(Path path) throws SEDALibException { String xmlData; - try (FileInputStream bais = new FileInputStream(path.toFile()); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + FileInputStream bais = new FileInputStream(path.toFile()); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { xmlReader.nextUsefullEvent(); xmlData = xmlReader.nextBlockAsStringIfNamed("ManagementMetadata"); } catch (XMLStreamException | SEDALibException | IOException e) { - throw new SEDALibException("Lecture des métadonnées globales à partir du fichier [" + path - + "] impossible", e); + throw new SEDALibException( + "Lecture des métadonnées globales à partir du fichier [" + path + "] impossible", + e + ); } return xmlData; } @@ -424,18 +435,13 @@ private ArchiveUnit processPath(Path path) throws SEDALibException, InterruptedE // test if already analyzed au = getArchiveUnit(path); - if (au != null) - return au; + if (au != null) return au; if (analyzeLink(path)) { - if (noLinkFlag) - au = null; - else - au = processSymbolicLink(lastAnalyzedLinkTarget); - } else if (Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - au = processDirectory(path); - else - au = processFile(path, true); + if (noLinkFlag) au = null; + else au = processSymbolicLink(lastAnalyzedLinkTarget); + } else if (Files.isDirectory(path, java.nio.file.LinkOption.NOFOLLOW_LINKS)) au = processDirectory(path); + else au = processFile(path, true); return au; } @@ -470,9 +476,9 @@ private ArchiveUnit processSymbolicLink(Path path) throws SEDALibException, Inte ArchiveUnit au; // verify it's in the original path - if (!isInRootPaths(lastAnalyzedLinkTarget)) - throw new SEDALibException( - "La cible du lien [" + path.toString() + "] est hors de la hiérarchie à importer"); + if (!isInRootPaths(lastAnalyzedLinkTarget)) throw new SEDALibException( + "La cible du lien [" + path.toString() + "] est hors de la hiérarchie à importer" + ); au = processPath(lastAnalyzedLinkTarget); return au; @@ -489,10 +495,8 @@ public static String extractDataObjectVersion(String filename) { filename = filename.substring(2); result = filename.substring(0, filename.indexOf('_')); filename = filename.substring(filename.indexOf('_') + 1); - if (filename.matches("[0-9]+__.*")) - result += "_" + filename.substring(0, filename.indexOf("__")); - else if (filename.matches("[0-9]+_.*")) - result += "_" + filename.substring(0, filename.indexOf("_")); + if (filename.matches("[0-9]+__.*")) result += "_" + filename.substring(0, filename.indexOf("__")); + else if (filename.matches("[0-9]+_.*")) result += "_" + filename.substring(0, filename.indexOf("_")); return result; } @@ -506,28 +510,35 @@ else if (filename.matches("[0-9]+_.*")) * @return the data object group containing this DataObject * @throws SEDALibException if there's a usage_version problem (coherence between file content and file name), or access problem to metadata file */ - private DataObjectGroup addPhysicalDataObjectMetadata(Path path, String filename, ArchiveUnit au, - DataObjectGroup dog) throws SEDALibException { + private DataObjectGroup addPhysicalDataObjectMetadata( + Path path, + String filename, + ArchiveUnit au, + DataObjectGroup dog + ) throws SEDALibException { String dataObjectVersion = extractDataObjectVersion(filename); if (dog == null) { dog = new DataObjectGroup(dataObjectPackage, null); au.addDataObjectById(dog.getInDataObjectPackageId()); } try { - PhysicalDataObject pdo = new PhysicalDataObject(dataObjectPackage, - new String(Files.readAllBytes(path), StandardCharsets.UTF_8)); - StringType pdoDataObjectVersion=pdo.getMetadataDataObjectVersion(); - if (pdoDataObjectVersion == null) - pdoDataObjectVersion = new StringType("DataObjectVersion",dataObjectVersion); - else if (!pdoDataObjectVersion.getValue().equals(dataObjectVersion)) - throw new SEDALibException( - "usage_version incomptabible entre le contenu du fichier [" + path.toString() + "] et son nom"); + PhysicalDataObject pdo = new PhysicalDataObject( + dataObjectPackage, + new String(Files.readAllBytes(path), StandardCharsets.UTF_8) + ); + StringType pdoDataObjectVersion = pdo.getMetadataDataObjectVersion(); + if (pdoDataObjectVersion == null) pdoDataObjectVersion = new StringType( + "DataObjectVersion", + dataObjectVersion + ); + else if (!pdoDataObjectVersion.getValue().equals(dataObjectVersion)) throw new SEDALibException( + "usage_version incomptabible entre le contenu du fichier [" + path.toString() + "] et son nom" + ); dog.addDataObject(pdo); } catch (IOException e) { throw new SEDALibException("Impossible d'accéder au fichier [" + path.toString() + "]"); } catch (SEDALibException e) { - throw new SEDALibException( - "Problème à la lecture du fichier [" + path.toString() + "]", e); + throw new SEDALibException("Problème à la lecture du fichier [" + path.toString() + "]", e); } return dog; } @@ -542,8 +553,12 @@ else if (!pdoDataObjectVersion.getValue().equals(dataObjectVersion)) * @return the data object group containing this DataObject * @throws SEDALibException if there's a usage_version problem (coherence between file content and file name), or access problem to metadata file */ - private DataObjectGroup addBinaryDataObjectMetadata(Path path, String filename, ArchiveUnit au, - DataObjectGroup dog) throws SEDALibException { + private DataObjectGroup addBinaryDataObjectMetadata( + Path path, + String filename, + ArchiveUnit au, + DataObjectGroup dog + ) throws SEDALibException { BinaryDataObject bdo; String dataObjectVersion = extractDataObjectVersion(filename); if (dog == null) { @@ -553,19 +568,22 @@ private DataObjectGroup addBinaryDataObjectMetadata(Path path, String filename, DataObject zdo = dog.findDataObjectByDataObjectVersion(dataObjectVersion); if (zdo == null) { try { - bdo = new BinaryDataObject(dataObjectPackage, new String(Files.readAllBytes(path), StandardCharsets.UTF_8)); - StringType bdoDataObjectVersion= bdo.getMetadataDataObjectVersion(); - if (bdoDataObjectVersion == null) - bdo.addMetadata(new StringType("DataObjectVersion",dataObjectVersion)); - else if (!bdoDataObjectVersion.getValue().equals(dataObjectVersion)) - throw new SEDALibException("usage_version incomptabible entre le contenu du fichier [" - + path.toString() + "] et son nom"); + bdo = new BinaryDataObject( + dataObjectPackage, + new String(Files.readAllBytes(path), StandardCharsets.UTF_8) + ); + StringType bdoDataObjectVersion = bdo.getMetadataDataObjectVersion(); + if (bdoDataObjectVersion == null) bdo.addMetadata( + new StringType("DataObjectVersion", dataObjectVersion) + ); + else if (!bdoDataObjectVersion.getValue().equals(dataObjectVersion)) throw new SEDALibException( + "usage_version incomptabible entre le contenu du fichier [" + path.toString() + "] et son nom" + ); dog.addDataObject(bdo); } catch (IOException e) { throw new SEDALibException("Impossible d'accéder au fichier [" + path.toString() + "]"); } catch (SEDALibException e) { - throw new SEDALibException( - "Problème à la lecture du fichier [" + path.toString() + "]", e); + throw new SEDALibException("Problème à la lecture du fichier [" + path.toString() + "]", e); } } else if (zdo instanceof BinaryDataObject) { bdo = (BinaryDataObject) zdo; @@ -574,12 +592,13 @@ else if (!bdoDataObjectVersion.getValue().equals(dataObjectVersion)) } catch (IOException e) { throw new SEDALibException("Impossible d'accéder au fichier [" + path.toString() + "]"); } catch (SEDALibException e) { - throw new SEDALibException( - "Problème à la lecture du fichier [" + path.toString() + "]", e); + throw new SEDALibException("Problème à la lecture du fichier [" + path.toString() + "]", e); } - } else - throw new SEDALibException("Les métadonnées du BinaryDataObject en [" + path.toString() - + "] s'applique un usage_version utilisé par un autre type de DataObject"); + } else throw new SEDALibException( + "Les métadonnées du BinaryDataObject en [" + + path.toString() + + "] s'applique un usage_version utilisé par un autre type de DataObject" + ); return dog; } @@ -593,15 +612,18 @@ else if (!bdoDataObjectVersion.getValue().equals(dataObjectVersion)) * @return the data object group containing this DataObject * @throws SEDALibException if there's an access problem to binary file */ - public static DataObjectGroup addBinaryDataObject(DataObjectPackage dataObjectPackage, Path path, String filename, ArchiveUnit au, DataObjectGroup dog) - throws SEDALibException { + public static DataObjectGroup addBinaryDataObject( + DataObjectPackage dataObjectPackage, + Path path, + String filename, + ArchiveUnit au, + DataObjectGroup dog + ) throws SEDALibException { BinaryDataObject bdo; String dataObjectVersion = extractDataObjectVersion(filename); filename = filename.substring(dataObjectVersion.length() + 2); - if (filename.startsWith("__")) - filename = filename.substring(2); - else - filename = filename.substring(1); + if (filename.startsWith("__")) filename = filename.substring(2); + else filename = filename.substring(1); if (dog == null) { dog = new DataObjectGroup(dataObjectPackage, null); au.addDataObjectById(dog.getInDataObjectPackageId()); @@ -612,13 +634,15 @@ public static DataObjectGroup addBinaryDataObject(DataObjectPackage dataObjectPa dog.addDataObject(bdo); } else if (zdo instanceof BinaryDataObject) { bdo = (BinaryDataObject) zdo; - if (bdo.getOnDiskPath() != null) - throw new SEDALibException("Un autre BinaryDataObject que [" + path.toString() - + "] a été créé avec le même usage_version"); + if (bdo.getOnDiskPath() != null) throw new SEDALibException( + "Un autre BinaryDataObject que [" + path.toString() + "] a été créé avec le même usage_version" + ); bdo.setOnDiskPath(path); - } else - throw new SEDALibException("Le BinaryDataObject en [" + path.toString() - + "] a un usage_version utilisé par un autre type de DataObject"); + } else throw new SEDALibException( + "Le BinaryDataObject en [" + + path.toString() + + "] a un usage_version utilisé par un autre type de DataObject" + ); return dog; } @@ -641,17 +665,20 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru // test if already analyzed au = getArchiveUnit(path); - if (au != null) - return au; + if (au != null) return au; // verify this is not a DataObjectGroup directory - if (isDataObjectGroupDirectory(path)) - throw new SEDALibException("Le chemin [" + path.toString() - + "] devrait décrire un ArchiveUnit, mais décrit un DataObjectGroup"); + if (isDataObjectGroupDirectory(path)) throw new SEDALibException( + "Le chemin [" + path.toString() + "] devrait décrire un ArchiveUnit, mais décrit un DataObjectGroup" + ); inCounter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, inCounter, "sedalib: "+ inCounter + - " ArchiveUnits importées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + inCounter, + "sedalib: " + inCounter + " ArchiveUnits importées" + ); String dirName = path.getFileName().toString(); @@ -663,8 +690,7 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru // get sorted list of sub paths pi = sp.iterator(); ArrayList subPathStringList = new ArrayList<>(100); - while (pi.hasNext()) - subPathStringList.add(pi.next().toString()); + while (pi.hasNext()) subPathStringList.add(pi.next().toString()); Collections.sort(subPathStringList); for (String curPathString : subPathStringList) { @@ -674,39 +700,38 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru if (!Files.isDirectory(curPath) && mustBeIgnored(fileName)) { continue; } else if (analyzeLink(curPath)) { - if (noLinkFlag) - continue; + if (noLinkFlag) continue; // verify it's in the currently imported path - if (!isInRootPaths(lastAnalyzedLinkTarget)) - throw new SEDALibException( - "Le lien [" + curPath.toString() + "] est hors du champ de l'import"); + if (!isInRootPaths(lastAnalyzedLinkTarget)) throw new SEDALibException( + "Le lien [" + curPath.toString() + "] est hors du champ de l'import" + ); // treat specific case of DataObjectGroup directory if (isDataObjectGroupDirectory(lastAnalyzedLinkTarget)) { modelVersion |= 2; au.addDataObjectById(processObjectGroup(lastAnalyzedLinkTarget).getInDataObjectPackageId()); } else { childAu = processPath(lastAnalyzedLinkTarget); - if (childAu == null) - continue; + if (childAu == null) continue; au.addChildArchiveUnit(childAu); } } else if (isDataObjectGroupDirectory(curPath)) { modelVersion |= 2; au.addDataObjectById(processObjectGroup(curPath).getInDataObjectPackageId()); - } else if (Files.isDirectory(curPath)) - au.addChildArchiveUnit(processDirectory(curPath)); - // manage files either ArchiveUnit file, BinaryDataObject file, ArchiveUnit - // metadata file or DataObject metadata file + } else if (Files.isDirectory(curPath)) au.addChildArchiveUnit(processDirectory(curPath)); + // manage files either ArchiveUnit file, BinaryDataObject file, ArchiveUnit + // metadata file or DataObject metadata file else { // Model V1 (GenerateurSeda) AU Content metadataXmlData file if (fileName.equals("ArchiveUnitContent.xml")) { modelVersion |= 1; try { au.setContentXmlData(new String(Files.readAllBytes(curPath), StandardCharsets.UTF_8)); - if (!au.getContentXmlData().isEmpty()) - auMetadataDefined = true; + if (!au.getContentXmlData().isEmpty()) auMetadataDefined = true; } catch (IOException e) { - throw new SEDALibException("Impossible d'accéder au fichier [" + curPath.toString() + "]", e); + throw new SEDALibException( + "Impossible d'accéder au fichier [" + curPath.toString() + "]", + e + ); } // Model V1 (GenerateurSeda) AU Management metadataXmlData file } else if (fileName.equals("ArchiveUnitManagement.xml")) { @@ -714,19 +739,26 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru try { au.setManagementXmlData(new String(Files.readAllBytes(curPath), StandardCharsets.UTF_8)); } catch (IOException e) { - throw new SEDALibException("Impossible d'accéder au fichier [" + curPath.toString() + "]", e); + throw new SEDALibException( + "Impossible d'accéder au fichier [" + curPath.toString() + "]", + e + ); } // Model V2 (SEDALib) AU Management metadataXmlData file } else if (fileName.equals("__ArchiveUnitMetadata.xml")) { modelVersion |= 2; try { au.fromSedaXmlFragments(new String(Files.readAllBytes(curPath), StandardCharsets.UTF_8)); - if ((au.getContentXmlData() != null) && !au.getContentXmlData().isEmpty()) - auMetadataDefined = true; + if ( + (au.getContentXmlData() != null) && !au.getContentXmlData().isEmpty() + ) auMetadataDefined = true; } catch (IOException e) { throw new SEDALibException( - "Impossible de lire les métadonnées de l'ArchiveUnit depuis le fichier [" - + curPath.toString() + "]", e); + "Impossible de lire les métadonnées de l'ArchiveUnit depuis le fichier [" + + curPath.toString() + + "]", + e + ); } // Model V2 (SEDALib) PhysicalDataObject metadataXmlData file } else if (fileName.matches("__\\w+(_[0-9]+)?__PhysicalDataObjectMetadata.xml")) { @@ -748,13 +780,10 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru au.addChildArchiveUnit(processFile(curPath, false)); } } - } - if (!auMetadataDefined) - au.setDefaultContent(extractTitleFromFileNameFunction.apply(dirName), "RecordGrp"); + if (!auMetadataDefined) au.setDefaultContent(extractTitleFromFileNameFunction.apply(dirName), "RecordGrp"); } catch (IOException e) { - throw new SEDALibException( - "Impossible de parcourir le répertoire [" + path.toString() + "]", e); + throw new SEDALibException("Impossible de parcourir le répertoire [" + path.toString() + "]", e); } return au; } @@ -775,7 +804,8 @@ private ArchiveUnit processDirectory(Path path) throws SEDALibException, Interru * @throws InterruptedException if import process is interrupted */ // - an ObjectGroup is associated with the file as BinaryMaster object - private ArchiveUnit processFile(Path path, boolean testIgnorePatterns) throws SEDALibException, InterruptedException { + private ArchiveUnit processFile(Path path, boolean testIgnorePatterns) + throws SEDALibException, InterruptedException { String filename; ArchiveUnit au; DataObjectGroup dog; @@ -783,22 +813,27 @@ private ArchiveUnit processFile(Path path, boolean testIgnorePatterns) throws SE // test if already analyzed au = getArchiveUnit(path); - if (au != null) - return au; + if (au != null) return au; filename = path.getFileName().toString(); // verify not to be ignored - if (testIgnorePatterns && mustBeIgnored(filename)) - return null; + if (testIgnorePatterns && mustBeIgnored(filename)) return null; // verify that the file is not one with special meaning - if (filename.equals("ArchiveUnitContent.xml") || filename.equals("ArchiveUnitManagement.xml") - || filename.equals("__ArchiveUnitMetadata.xml") || filename.matches("__\\w+__.+")) - throw new SEDALibException("Le chemin [" + path.toString() + "] a la racine de l'import n'a pas de sens"); + if ( + filename.equals("ArchiveUnitContent.xml") || + filename.equals("ArchiveUnitManagement.xml") || + filename.equals("__ArchiveUnitMetadata.xml") || + filename.matches("__\\w+__.+") + ) throw new SEDALibException("Le chemin [" + path.toString() + "] a la racine de l'import n'a pas de sens"); inCounter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, inCounter, "sedalib: " + inCounter + - " ArchiveUnits importées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + inCounter, + "sedalib: " + inCounter + " ArchiveUnits importées" + ); dog = new DataObjectGroup(dataObjectPackage, path); bdo = new BinaryDataObject(dataObjectPackage, path, null, "BinaryMaster_1"); @@ -827,8 +862,7 @@ private DataObjectGroup processObjectGroup(Path path) throws SEDALibException { DataObjectGroup dog; dog = getDataObjectGroup(path); - if (dog != null) - return dog; + if (dog != null) return dog; dog = new DataObjectGroup(dataObjectPackage, path); dogPathStringMap.put(dog.getOnDiskPath().toString(), dog); @@ -837,12 +871,12 @@ private DataObjectGroup processObjectGroup(Path path) throws SEDALibException { pi = sp.iterator(); while (pi.hasNext()) { curPath = pi.next(); - if (Files.isSymbolicLink(curPath)) - throw new SEDALibException( - "Le lien [" + path.toString() + "] ne peut pas pointer vers un BinaryDataObject"); - else if (Files.isDirectory(curPath)) - throw new SEDALibException("Un répertoire de DataObjectGroup ne peut pas contenir un répertoire [" - + path.toString() + "]"); + if (Files.isSymbolicLink(curPath)) throw new SEDALibException( + "Le lien [" + path.toString() + "] ne peut pas pointer vers un BinaryDataObject" + ); + else if (Files.isDirectory(curPath)) throw new SEDALibException( + "Un répertoire de DataObjectGroup ne peut pas contenir un répertoire [" + path.toString() + "]" + ); else { String fileName = curPath.getFileName().toString(); // Model V2 (SEDALib) PhysicalDataObject metadataXmlData file @@ -856,9 +890,9 @@ else if (Files.isDirectory(curPath)) // Model V1&V2 BinaryDataObject file } else if (fileName.matches("__\\w+__.+")) { addBinaryDataObject(dataObjectPackage, curPath, fileName, null, dog); - } else - throw new SEDALibException("Le chemin [" + path.toString() + "] ne décrit pas un DataObject"); - + } else throw new SEDALibException( + "Le chemin [" + path.toString() + "] ne décrit pas un DataObject" + ); } } } catch (IOException e) { @@ -888,7 +922,7 @@ public void doImport() throws SEDALibException, InterruptedException { start = Instant.now(); try (Stream sp = onDiskRootPaths.stream()) { - inCounter=0; + inCounter = 0; pi = sp.iterator(); while (pi.hasNext()) { nextPath = pi.next(); @@ -897,25 +931,41 @@ public void doImport() throws SEDALibException, InterruptedException { continue; } au = processPath(nextPath); - if (au != null) - dataObjectPackage.addRootAu(au); + if (au != null) dataObjectPackage.addRootAu(au); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: " + inCounter + " métadonnées ArchiveUnits importées dans le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + inCounter + " métadonnées ArchiveUnits importées dans le DataObjectPackage", + null + ); } catch (SEDALibException e) { - throw new SEDALibException("Impossible d'importer les ressources du répertoire [" - + nextPath.toString() + "]",e); + throw new SEDALibException( + "Impossible d'importer les ressources du répertoire [" + nextPath.toString() + "]", + e + ); } inCounter = 0; for (Map.Entry pair : dataObjectPackage.getBdoInDataObjectPackageIdMap().entrySet()) { - FileInfo fileInfo= pair.getValue().getMetadataFileInfo(); - if (fileInfo.getSimpleMetadata("LastModified") == null) - pair.getValue().extractTechnicalElements(sedaLibProgressLogger); + FileInfo fileInfo = pair.getValue().getMetadataFileInfo(); + if (fileInfo.getSimpleMetadata("LastModified") == null) pair + .getValue() + .extractTechnicalElements(sedaLibProgressLogger); inCounter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, inCounter, "sedalib: " + inCounter + - " fichiers BinaryDataObject analysés"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + inCounter, + "sedalib: " + inCounter + " fichiers BinaryDataObject analysés" + ); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.STEP, "sedalib: "+ inCounter + " fichiers BinaryDataObject analysés et importés dans le DataObjectPackage", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.STEP, + "sedalib: " + inCounter + " fichiers BinaryDataObject analysés et importés dans le DataObjectPackage", + null + ); end = Instant.now(); } @@ -978,8 +1028,8 @@ public String getSummary() { result += "encodé selon un modèle hybride V1/V2 de la structure\n"; break; } - if ((start != null) && (end != null)) - result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; + if ((start != null) && (end != null)) result += + "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java index d6bc5926..c71b1ecb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/SIPToArchiveTransferImporter.java @@ -107,8 +107,10 @@ public class SIPToArchiveTransferImporter { public String unZipSip(String zipFile, String outputFolder) throws SEDALibException, InterruptedException { String manifest = null; int counter = 0; - try (FileInputStream fis = new FileInputStream(zipFile); - ZipArchiveInputStream zais = new ZipArchiveInputStream(fis)) { + try ( + FileInputStream fis = new FileInputStream(zipFile); + ZipArchiveInputStream zais = new ZipArchiveInputStream(fis) + ) { // create output directory is not exists File folder = new File(outputFolder); if (!folder.exists()) { @@ -121,44 +123,60 @@ public String unZipSip(String zipFile, String outputFolder) throws SEDALibExcept String fileName = ze.getName().trim(); // change any case ConTenT to lowercase content on import as in fromSEDA in // BinaryDataObject - if (fileName.toLowerCase().startsWith("content")) - fileName = "content" + fileName.substring(7); + if (fileName.toLowerCase().startsWith("content")) fileName = "content" + fileName.substring(7); Path newPath = Paths.get(outputFolder + File.separator + fileName); if (fileName.endsWith("/")) { - if (!Files.exists(newPath)) - Files.createDirectories(newPath); + if (!Files.exists(newPath)) Files.createDirectories(newPath); } else { if (fileName.toLowerCase().matches("[^/\\\\]*manifest.*\\.xml")) { - if (manifest != null) - throw new SEDALibException("SIP mal formé, plusieurs fichiers manifest potentiels"); + if (manifest != null) throw new SEDALibException( + "SIP mal formé, plusieurs fichiers manifest potentiels" + ); manifest = fileName; - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: unzip manifest [" + zipFile + "]",null); - } else - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, "sedalib: unzip fichier [" + zipFile + "]", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: unzip manifest [" + zipFile + "]", + null + ); + } else doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + "sedalib: unzip fichier [" + zipFile + "]", + null + ); // create all non exists folders // else you will hit FileNotFoundException for compressed folder - if (!Files.exists(newPath.getParent())) - Files.createDirectories(newPath.getParent()); + if (!Files.exists(newPath.getParent())) Files.createDirectories(newPath.getParent()); - try(FileOutputStream fos = new FileOutputStream(newPath.toFile())) { + try (FileOutputStream fos = new FileOutputStream(newPath.toFile())) { IOUtils.copy(zais, fos); counter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, Integer.toString(counter) + - " fichiers extraits"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + Integer.toString(counter) + " fichiers extraits" + ); } } } } catch (IOException ex) { - throw new SEDALibException("Impossible de décompresser le fichier [" + zipFile + "] dans le répertoire [" - + outputFolder + "]", ex); + throw new SEDALibException( + "Impossible de décompresser le fichier [" + zipFile + "] dans le répertoire [" + outputFolder + "]", + ex + ); } - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, "sedalib: "+ counter + - " fichiers extraits"); - if (manifest == null) - throw new SEDALibException("SIP mal formé, pas de manifest"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + "sedalib: " + counter + " fichiers extraits" + ); + if (manifest == null) throw new SEDALibException("SIP mal formé, pas de manifest"); return manifest; } @@ -170,21 +188,28 @@ public String unZipSip(String zipFile, String outputFolder) throws SEDALibExcept * @param sedaLibProgressLogger the progress logger or null if no progress log expected * @throws SEDALibException if file or directory doesn't exist */ - public SIPToArchiveTransferImporter(String zipFile, String unCompressDirectory, SEDALibProgressLogger sedaLibProgressLogger) throws SEDALibException { + public SIPToArchiveTransferImporter( + String zipFile, + String unCompressDirectory, + SEDALibProgressLogger sedaLibProgressLogger + ) throws SEDALibException { Path zipFilePath, unCompressDirectoryPath; zipFilePath = Paths.get(zipFile); - if (!Files.isRegularFile(zipFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + zipFile + "] pointant vers le SIP ne désigne pas un fichier"); + if (!Files.isRegularFile(zipFilePath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) throw new SEDALibException( + "Le chemin [" + zipFile + "] pointant vers le SIP ne désigne pas un fichier" + ); unCompressDirectoryPath = Paths.get(unCompressDirectory).toAbsolutePath(); - if (!Files.exists(unCompressDirectoryPath)) - try { - Files.createDirectories(unCompressDirectoryPath); - } catch (IOException e) { - throw new SEDALibException("Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]"); - } - if (!Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS)) - throw new SEDALibException("Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire"); + if (!Files.exists(unCompressDirectoryPath)) try { + Files.createDirectories(unCompressDirectoryPath); + } catch (IOException e) { + throw new SEDALibException("Impossible de créer le répertoire d'extraction [" + unCompressDirectory + "]"); + } + if ( + !Files.isDirectory(unCompressDirectoryPath, java.nio.file.LinkOption.NOFOLLOW_LINKS) + ) throw new SEDALibException( + "Le chemin [" + unCompressDirectory + "] pointant le répertoire d'extraction ne désigne pas un répertoire" + ); this.zipFile = zipFile; this.unCompressDirectory = unCompressDirectoryPath.normalize().toString(); @@ -206,20 +231,21 @@ public void doImport() throws SEDALibException, InterruptedException { String log = "sedalib: début de l'import du SIP\n"; log += "en [" + zipFile + "]"; log += " date=" + DateFormat.getDateTimeInstance().format(d); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, log, null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, log, null); manifest = unZipSip(zipFile, unCompressDirectory); - try (FileInputStream fis = new FileInputStream(unCompressDirectory + File.separator + manifest); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(fis)) { + try ( + FileInputStream fis = new FileInputStream(unCompressDirectory + File.separator + manifest); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(fis) + ) { archiveTransfer = ArchiveTransfer.fromSedaXml(xmlReader, unCompressDirectory, sedaLibProgressLogger); } catch (XMLStreamException | IOException e) { - throw new SEDALibException("Impossible d'importer le fichier [" + manifest - + "] comme manifest du SIP", e); + throw new SEDALibException("Impossible d'importer le fichier [" + manifest + "] comme manifest du SIP", e); } end = Instant.now(); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, "sedalib: import du SIP terminé", null); + doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, "sedalib: import du SIP terminé", null); } /** @@ -240,10 +266,7 @@ public String getSummary() { String result; result = archiveTransfer.getDescription() + "\n"; - if (start != null) - result += "chargé en " - + Duration.between(start, end).toString().substring(2) + "\n"; + if (start != null) result += "chargé en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java index 8ca035a8..c67ed9c3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/WindowsShortcut.java @@ -100,12 +100,13 @@ public class WindowsShortcut { public static boolean isPotentialValidLink(final File file) { final int minimum_length = 0x64; boolean isPotentiallyValid = false; - if (file.getName().toLowerCase().endsWith(".lnk")) - try (final InputStream fis = new FileInputStream(file)) { - isPotentiallyValid = file.isFile() && fis.available() >= minimum_length && isMagicPresent(getBytes(fis, 32)); - } catch (Exception e) { - // forget it - } + if (file.getName().toLowerCase().endsWith(".lnk")) try (final InputStream fis = new FileInputStream(file)) { + isPotentiallyValid = file.isFile() && + fis.available() >= minimum_length && + isMagicPresent(getBytes(fis, 32)); + } catch (Exception e) { + // forget it + } return isPotentiallyValid; } @@ -221,8 +222,7 @@ private static byte[] getBytes(final InputStream in, Integer max) throws IOExcep break; } bout.write(buff, 0, n); - if (max != null) - max -= n; + if (max != null) max -= n; } in.close(); return bout.toByteArray(); @@ -248,8 +248,7 @@ private static boolean isMagicPresent(final byte[] link) { */ private void parseLink(final byte[] link) throws ParseException { try { - if (!isMagicPresent(link)) - throw new ParseException("Invalid shortcut; magic is missing", 0); + if (!isMagicPresent(link)) throw new ParseException("Invalid shortcut; magic is missing", 0); // get the flags byte final byte flags = link[0x14]; @@ -286,10 +285,11 @@ private void parseLink(final byte[] link) throws ParseException { final String basename = getNullDelimitedString(link, basename_offset); real_file = basename + finalname; } else { - final int networkVolumeTable_offset = bytesToDword(link, file_start + networkVolumeTable_offset_offset) + file_start; + final int networkVolumeTable_offset = + bytesToDword(link, file_start + networkVolumeTable_offset_offset) + file_start; final int shareName_offset_offset = 0x08; - final int shareName_offset = bytesToDword(link, networkVolumeTable_offset + shareName_offset_offset) - + networkVolumeTable_offset; + final int shareName_offset = + bytesToDword(link, networkVolumeTable_offset + shareName_offset_offset) + networkVolumeTable_offset; final String shareName = getNullDelimitedString(link, shareName_offset); real_file = shareName + "\\" + finalname; } @@ -329,7 +329,6 @@ private void parseLink(final byte[] link) throws ParseException { final int string_len = bytesToWord(link, next_string_start) * 2; // times 2 because UTF-16 command_line_arguments = getUTF16String(link, next_string_start + 2, string_len); } - } catch (final ArrayIndexOutOfBoundsException e) { throw new ParseException("Could not be parsed, probably not a valid WindowsShortcut", 0); } @@ -388,5 +387,4 @@ private static int bytesToWord(final byte[] bytes, final int off) { private static int bytesToDword(final byte[] bytes, final int off) { return (bytesToWord(bytes, off + 2) << 16) | bytesToWord(bytes, off); } - -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java index 7a494c53..5c7606c9 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/importer/package-info.java @@ -38,4 +38,4 @@ /** * Package for tools importing archive structure and metadata from disk hierarchy, and from SEDA packets SIP/DIP */ -package fr.gouv.vitam.tools.sedalib.inout.importer; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.inout.importer; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java index 0d5b048d..19997745 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/inout/package-info.java @@ -39,4 +39,4 @@ * Package for building, importing and exporting archive structure and metadata tools * (for high-level usage, see the SIPBuilder class). */ -package fr.gouv.vitam.tools.sedalib.inout; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.inout; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java index 938cd5f3..3e7b19b5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadata.java @@ -52,10 +52,8 @@ import fr.gouv.vitam.tools.sedalib.metadata.namedtype.StringType; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; -import java.util.AbstractMap.SimpleEntry; import java.util.LinkedHashMap; import java.util.Map; -import java.util.stream.IntStream; /** * The Class ManagementMetadata. @@ -77,29 +75,21 @@ public class ManagementMetadata extends ComplexListType { static { metadataMap = new LinkedHashMap<>(); - metadataMap.put("ArchivalProfile", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap.put("ArchivalProfile", new ComplexListMetadataKind(StringType.class, false)); metadataMap.put("ServiceLevel", new ComplexListMetadataKind(StringType.class, false)); - metadataMap.put("AcquisitionInformation", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap.put("AcquisitionInformation", new ComplexListMetadataKind(StringType.class, false)); metadataMap.put("LegalStatus", new ComplexListMetadataKind(StringType.class, false)); - metadataMap.put("OriginatingAgencyIdentifier", - new ComplexListMetadataKind(StringType.class, false)); - metadataMap.put("SubmissionAgencyIdentifier", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap.put("OriginatingAgencyIdentifier", new ComplexListMetadataKind(StringType.class, false)); + metadataMap.put("SubmissionAgencyIdentifier", new ComplexListMetadataKind(StringType.class, false)); metadataMap.put("StorageRule", new ComplexListMetadataKind(StorageRule.class, false)); metadataMap.put("AppraisalRule", new ComplexListMetadataKind(AppraisalRule.class, false)); metadataMap.put("AccessRule", new ComplexListMetadataKind(AccessRule.class, false)); - metadataMap.put("DisseminationRule", - new ComplexListMetadataKind(DisseminationRule.class, false)); + metadataMap.put("DisseminationRule", new ComplexListMetadataKind(DisseminationRule.class, false)); metadataMap.put("ReuseRule", new ComplexListMetadataKind(ReuseRule.class, false)); - metadataMap.put("ClassificationRule", - new ComplexListMetadataKind(ClassificationRule.class, false)); - metadataMap.put("HoldRule", - new ComplexListMetadataKind(HoldRule.class, false)); + metadataMap.put("ClassificationRule", new ComplexListMetadataKind(ClassificationRule.class, false)); + metadataMap.put("HoldRule", new ComplexListMetadataKind(HoldRule.class, false)); metadataMap.put("LogBook", new ComplexListMetadataKind(AnyXMLType.class, false)); - metadataMap.put("NeedAuthorization", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap.put("NeedAuthorization", new ComplexListMetadataKind(StringType.class, false)); } /** @@ -172,4 +162,4 @@ public void addMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { } super.addMetadata(sedaMetadata); } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java index e206c2c0..9cac1b5d 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/Operation.java @@ -57,7 +57,7 @@ */ public class Operation extends ComplexListType { - static final String EVENT_TAG="Event"; + static final String EVENT_TAG = "Event"; /** * Init metadata map. @@ -85,10 +85,11 @@ public Operation() { */ public Operation(Object... args) throws SEDALibException { this(); - for (int i=0;i toCsvList() throws SEDALibException; + public abstract LinkedHashMap toCsvList() throws SEDALibException; /** * Return the indented XML export form as the String representation. @@ -116,16 +119,16 @@ public abstract class SEDAMetadata { */ public String toString() { String result = null; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2) + ) { toSedaXml(xmlWriter); xmlWriter.flush(); result = baos.toString("UTF-8"); - if (result.startsWith("\n")) - result = result.substring(1); + if (result.startsWith("\n")) result = result.substring(1); } catch (XMLStreamException | IOException | SEDALibException e) { - if (result == null) - result = super.toString(); + if (result == null) result = super.toString(); } return result; } @@ -139,7 +142,6 @@ public String toString() { */ public abstract boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibException; - /** * Return the SEDAMetadata object from an XML event reader. * @@ -154,20 +156,26 @@ public static SEDAMetadata fromSedaXml(SEDAXMLEventReader xmlReader, Class ta SEDAMetadata sm; if (needName) { XMLEvent event = xmlReader.peekUsefullEvent(); - sm = (SEDAMetadata) ConstructorUtils.invokeConstructor(target, event.asStartElement().getName().getLocalPart()); - } else - sm = (SEDAMetadata) ConstructorUtils.invokeConstructor(target, (Object[])null); - if (sm.fillFromSedaXml(xmlReader)) - return sm; + sm = (SEDAMetadata) ConstructorUtils.invokeConstructor( + target, + event.asStartElement().getName().getLocalPart() + ); + } else sm = (SEDAMetadata) ConstructorUtils.invokeConstructor(target, (Object[]) null); + if (sm.fillFromSedaXml(xmlReader)) return sm; Method method = target.getMethod("fromSedaXml", SEDAXMLEventReader.class); return (SEDAMetadata) method.invoke(null, xmlReader); - } catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException - | SecurityException | InstantiationException e) { + } catch ( + IllegalAccessException + | IllegalArgumentException + | NoSuchMethodException + | SecurityException + | InstantiationException e + ) { throw new SEDALibException("Erreur de construction du " + target.getSimpleName(), e); } catch (InvocationTargetException te) { throw new SEDALibException("Erreur de construction du " + target.getSimpleName(), te.getTargetException()); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur de lecture XML dans un élément de type "+target.getSimpleName(), e); + throw new SEDALibException("Erreur de lecture XML dans un élément de type " + target.getSimpleName(), e); } } @@ -182,14 +190,15 @@ public static SEDAMetadata fromSedaXml(SEDAXMLEventReader xmlReader, Class ta public static SEDAMetadata fromString(String xmlData, Class target) throws SEDALibException { SEDAMetadata result; - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); result = fromSedaXml(xmlReader, target); XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new SEDALibException("Il y a des champs illégaux"); + if (!event.isEndDocument()) throw new SEDALibException("Il y a des champs illégaux"); } catch (XMLStreamException | SEDALibException | IOException e) { throw new SEDALibException("Erreur de lecture de " + target.getSimpleName(), e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java index 68b058be..778d8556 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/Document.java @@ -67,9 +67,8 @@ public class Document extends ComplexListType { public static final Map metadataMap_default; static { - metadataMap_default = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism - metadataMap_default.put("RecordGrpID", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap_default = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_default.put("RecordGrpID", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("Management", new ComplexListMetadataKind(Management.class, false)); metadataMap_default.put("Content", new ComplexListMetadataKind(Content.class, false)); metadataMap_default.put("FileObject", new ComplexListMetadataKind(FileObject.class, true)); @@ -92,7 +91,6 @@ public Document() { */ public Document(String recordGrpID, Content content) throws SEDALibException { super("Document"); - addNewMetadata("RecordGrpID", recordGrpID); addMetadata(content); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java index a9636f09..75891e78 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentContainer.java @@ -66,13 +66,10 @@ public class DocumentContainer extends ComplexListType { public static final Map metadataMap_default; static { - metadataMap_default = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism - metadataMap_default.put("DocumentsCount", - new ComplexListMetadataKind(IntegerType.class, false)); - metadataMap_default.put("FileObjectsCount", - new ComplexListMetadataKind(IntegerType.class, false)); - metadataMap_default.put("RecordGrp", - new ComplexListMetadataKind(RecordGrp.class, false)); + metadataMap_default = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_default.put("DocumentsCount", new ComplexListMetadataKind(IntegerType.class, false)); + metadataMap_default.put("FileObjectsCount", new ComplexListMetadataKind(IntegerType.class, false)); + metadataMap_default.put("RecordGrp", new ComplexListMetadataKind(RecordGrp.class, false)); } /** @@ -90,10 +87,8 @@ public DocumentContainer() { * @param recordGrp the record grp * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public DocumentContainer(int documentsCounts, int fileObjectsCount, - RecordGrp recordGrp) throws SEDALibException { + public DocumentContainer(int documentsCounts, int fileObjectsCount, RecordGrp recordGrp) throws SEDALibException { super("DocumentContainer"); - addNewMetadata("DocumentsCount", documentsCounts); addNewMetadata("FileObjectsCount", fileObjectsCount); addMetadata(recordGrp); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java index 3c0ec9bb..f18f7f62 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/DocumentPack.java @@ -66,15 +66,11 @@ public class DocumentPack extends ComplexListType { public static final Map metadataMap_default; static { - metadataMap_default = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism - metadataMap_default.put("DocumentsCount", - new ComplexListMetadataKind(IntegerType.class, false)); - metadataMap_default.put("FileObjectsCount", - new ComplexListMetadataKind(IntegerType.class, false)); - metadataMap_default.put("RecordGrp", - new ComplexListMetadataKind(RecordGrp.class, false)); - metadataMap_default.put("Document", - new ComplexListMetadataKind(Document.class, true)); + metadataMap_default = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_default.put("DocumentsCount", new ComplexListMetadataKind(IntegerType.class, false)); + metadataMap_default.put("FileObjectsCount", new ComplexListMetadataKind(IntegerType.class, false)); + metadataMap_default.put("RecordGrp", new ComplexListMetadataKind(RecordGrp.class, false)); + metadataMap_default.put("Document", new ComplexListMetadataKind(Document.class, true)); } /** @@ -92,7 +88,6 @@ public DocumentPack() { */ public DocumentPack(RecordGrp recordGrp) throws SEDALibException { super("DocumentPack"); - addMetadata(recordGrp); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java index d89e914c..d4159be0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/FileObject.java @@ -90,7 +90,7 @@ public class FileObject extends ComplexListType { static { METADATA_MAP_V2 = new LinkedHashMap<>(); METADATA_MAP_V2.put("DataObjectProfile", new ComplexListMetadataKind(StringType.class, false)); - METADATA_MAP_V2.put("Relationship", new ComplexListMetadataKind(Relationship.class, true)); + METADATA_MAP_V2.put("Relationship", new ComplexListMetadataKind(Relationship.class, true)); METADATA_MAP_V2.put("DataObjectVersion", new ComplexListMetadataKind(StringType.class, false)); METADATA_MAP_V2.put("Uri", new ComplexListMetadataKind(StringType.class, false)); @@ -124,6 +124,7 @@ public class FileObject extends ComplexListType { METADATA_MAP_V3.put("Metadata", new ComplexListMetadataKind(Metadata.class, false)); METADATA_MAP_V3.put("OtherMetadata", new ComplexListMetadataKind(AnyXMLListType.class, false)); } + /** * Instantiates a new FileObject. */ @@ -140,9 +141,7 @@ public FileObject() { */ public FileObject(BinaryDataObject binaryDataObject, String uri) throws SEDALibException { super("FileObject"); - - for (SEDAMetadata sm: binaryDataObject.getMetadataList()) - addMetadata (sm); + for (SEDAMetadata sm : binaryDataObject.getMetadataList()) addMetadata(sm); if (uri != null) addMetadata(new StringType("Uri", uri)); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java index 613740c2..f71b8fc0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/RecordGrp.java @@ -72,9 +72,8 @@ public class RecordGrp extends ComplexListType { public static final Map metadataMap_default; static { - metadataMap_default = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism - metadataMap_default.put("RecordGrpID", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap_default = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_default.put("RecordGrpID", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("Management", new ComplexListMetadataKind(Management.class, false)); metadataMap_default.put("Content", new ComplexListMetadataKind(Content.class, false)); metadataMap_default.put(ELEMENT_NAME, new ComplexListMetadataKind(RecordGrp.class, true)); @@ -96,11 +95,8 @@ public RecordGrp() { */ public RecordGrp(String recordGrpID, Content content, Management management) throws SEDALibException { super(ELEMENT_NAME); - addNewMetadata("RecordGrpID", recordGrpID); - if (content != null) - addMetadata(content); - if (management != null) - addMetadata(management); + if (content != null) addMetadata(content); + if (management != null) addMetadata(management); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java index eed2ee2d..f28ddbf5 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/compacted/SubDocument.java @@ -71,7 +71,7 @@ public class SubDocument extends ComplexListType { public static final Map metadataMap_default; static { - metadataMap_default = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_default = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism metadataMap_default.put("Management", new ComplexListMetadataKind(Management.class, false)); metadataMap_default.put("Content", new ComplexListMetadataKind(Content.class, false)); metadataMap_default.put("FileObject", new ComplexListMetadataKind(FileObject.class, true)); @@ -93,7 +93,6 @@ public SubDocument() { */ public SubDocument(Content content) throws SEDALibException { super(ELEMENT_NAME); - addMetadata(content); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java index a3368c92..7c73fa5c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/AdditionalProof.java @@ -85,7 +85,9 @@ public AdditionalProof() { */ public AdditionalProof(String additionalProofInformation) throws SEDALibException { super("AdditionalProof"); - if (additionalProofInformation != null) - addNewMetadata("AdditionalProofInformation", additionalProofInformation); + if (additionalProofInformation != null) addNewMetadata( + "AdditionalProofInformation", + additionalProofInformation + ); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java index 4ef09601..c4a6de83 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Content.java @@ -71,21 +71,17 @@ public class Content extends ComplexListType { public static final Map metadataMap; static { - metadataMap = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism + metadataMap = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism metadataMap.put("DescriptionLevel", new ComplexListMetadataKind(EnumType.class, false)); metadataMap.put("Title", new ComplexListMetadataKind(TextType.class, true)); metadataMap.put("FilePlanPosition", new ComplexListMetadataKind(StringType.class, true)); metadataMap.put("SystemId", new ComplexListMetadataKind(StringType.class, true)); metadataMap.put("OriginatingSystemId", new ComplexListMetadataKind(StringType.class, true)); - metadataMap.put("ArchivalAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap.put("OriginatingAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap.put("TransferringAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); + metadataMap.put("ArchivalAgencyArchiveUnitIdentifier", new ComplexListMetadataKind(StringType.class, true)); + metadataMap.put("OriginatingAgencyArchiveUnitIdentifier", new ComplexListMetadataKind(StringType.class, true)); + metadataMap.put("TransferringAgencyArchiveUnitIdentifier", new ComplexListMetadataKind(StringType.class, true)); metadataMap.put("Description", new ComplexListMetadataKind(TextType.class, true)); - metadataMap.put("CustodialHistory", - new ComplexListMetadataKind(CustodialHistory.class, false)); + metadataMap.put("CustodialHistory", new ComplexListMetadataKind(CustodialHistory.class, false)); metadataMap.put("Type", new ComplexListMetadataKind(StringType.class, false)); metadataMap.put("DocumentType", new ComplexListMetadataKind(StringType.class, false)); metadataMap.put("Language", new ComplexListMetadataKind(StringType.class, true)); @@ -95,10 +91,8 @@ public class Content extends ComplexListType { metadataMap.put("Tag", new ComplexListMetadataKind(StringType.class, true)); metadataMap.put("Keyword", new ComplexListMetadataKind(Keyword.class, true)); metadataMap.put("Coverage", new ComplexListMetadataKind(Coverage.class, false)); - metadataMap.put("OriginatingAgency", - new ComplexListMetadataKind(AgencyType.class, false)); - metadataMap.put("SubmissionAgency", - new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap.put("OriginatingAgency", new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap.put("SubmissionAgency", new ComplexListMetadataKind(AgencyType.class, false)); // can't implement AgentAbstract (abstract in middle of th list...) metadataMap.put("AuthorizedAgent", new ComplexListMetadataKind(AgentType.class, true)); metadataMap.put("Writer", new ComplexListMetadataKind(AgentType.class, true)); @@ -131,21 +125,23 @@ public class Content extends ComplexListType { public static final Map metadataMap_v2; static { - metadataMap_v2 = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_v2 = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism metadataMap_v2.put("DescriptionLevel", new ComplexListMetadataKind(EnumType.class, false)); metadataMap_v2.put("Title", new ComplexListMetadataKind(TextType.class, true)); metadataMap_v2.put("FilePlanPosition", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v2.put("SystemId", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v2.put("OriginatingSystemId", new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v2.put("ArchivalAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v2.put("OriginatingAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v2.put("TransferringAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); + metadataMap_v2.put("ArchivalAgencyArchiveUnitIdentifier", new ComplexListMetadataKind(StringType.class, true)); + metadataMap_v2.put( + "OriginatingAgencyArchiveUnitIdentifier", + new ComplexListMetadataKind(StringType.class, true) + ); + metadataMap_v2.put( + "TransferringAgencyArchiveUnitIdentifier", + new ComplexListMetadataKind(StringType.class, true) + ); metadataMap_v2.put("Description", new ComplexListMetadataKind(TextType.class, true)); - metadataMap_v2.put("CustodialHistory", - new ComplexListMetadataKind(CustodialHistory.class, false)); + metadataMap_v2.put("CustodialHistory", new ComplexListMetadataKind(CustodialHistory.class, false)); metadataMap_v2.put("Type", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("DocumentType", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("Language", new ComplexListMetadataKind(StringType.class, true)); @@ -155,10 +151,8 @@ public class Content extends ComplexListType { metadataMap_v2.put("Tag", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v2.put("Keyword", new ComplexListMetadataKind(Keyword.class, true)); metadataMap_v2.put("Coverage", new ComplexListMetadataKind(Coverage.class, false)); - metadataMap_v2.put("OriginatingAgency", - new ComplexListMetadataKind(AgencyType.class, false)); - metadataMap_v2.put("SubmissionAgency", - new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap_v2.put("OriginatingAgency", new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap_v2.put("SubmissionAgency", new ComplexListMetadataKind(AgencyType.class, false)); // specific in Seda 2.2 metadataMap_v2.put("Agent", new ComplexListMetadataKind(AgentType.class, true)); metadataMap_v2.put("AuthorizedAgent", new ComplexListMetadataKind(AgentType.class, true)); @@ -193,21 +187,23 @@ public class Content extends ComplexListType { public static final Map metadataMap_v3; static { - metadataMap_v3 = new LinkedHashMap<>();//NOSONAR public mandatory for ComplexlistType mechanism + metadataMap_v3 = new LinkedHashMap<>(); //NOSONAR public mandatory for ComplexlistType mechanism metadataMap_v3.put("DescriptionLevel", new ComplexListMetadataKind(EnumType.class, false)); metadataMap_v3.put("Title", new ComplexListMetadataKind(TextType.class, true)); metadataMap_v3.put("FilePlanPosition", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v3.put("SystemId", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v3.put("OriginatingSystemId", new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v3.put("ArchivalAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v3.put("OriginatingAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); - metadataMap_v3.put("TransferringAgencyArchiveUnitIdentifier", - new ComplexListMetadataKind(StringType.class, true)); + metadataMap_v3.put("ArchivalAgencyArchiveUnitIdentifier", new ComplexListMetadataKind(StringType.class, true)); + metadataMap_v3.put( + "OriginatingAgencyArchiveUnitIdentifier", + new ComplexListMetadataKind(StringType.class, true) + ); + metadataMap_v3.put( + "TransferringAgencyArchiveUnitIdentifier", + new ComplexListMetadataKind(StringType.class, true) + ); metadataMap_v3.put("Description", new ComplexListMetadataKind(TextType.class, true)); - metadataMap_v3.put("CustodialHistory", - new ComplexListMetadataKind(CustodialHistory.class, false)); + metadataMap_v3.put("CustodialHistory", new ComplexListMetadataKind(CustodialHistory.class, false)); metadataMap_v3.put("Type", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v3.put("DocumentType", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v3.put("Language", new ComplexListMetadataKind(StringType.class, true)); @@ -217,10 +213,8 @@ public class Content extends ComplexListType { metadataMap_v3.put("Tag", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v3.put("Keyword", new ComplexListMetadataKind(Keyword.class, true)); metadataMap_v3.put("Coverage", new ComplexListMetadataKind(Coverage.class, false)); - metadataMap_v3.put("OriginatingAgency", - new ComplexListMetadataKind(AgencyType.class, false)); - metadataMap_v3.put("SubmissionAgency", - new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap_v3.put("OriginatingAgency", new ComplexListMetadataKind(AgencyType.class, false)); + metadataMap_v3.put("SubmissionAgency", new ComplexListMetadataKind(AgencyType.class, false)); metadataMap_v3.put("Agent", new ComplexListMetadataKind(AgentType.class, true)); metadataMap_v3.put("AuthorizedAgent", new ComplexListMetadataKind(AgentType.class, true)); metadataMap_v3.put("Writer", new ComplexListMetadataKind(AgentType.class, true)); @@ -266,18 +260,18 @@ public Content() { */ public String filteredToString(List keptMetadataList) { String result; - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2) + ) { xmlWriter.writeStartElement(elementName); for (SEDAMetadata sm : metadataList) { - if (keptMetadataList.contains(sm.getXmlElementName())) - sm.toSedaXml(xmlWriter); + if (keptMetadataList.contains(sm.getXmlElementName())) sm.toSedaXml(xmlWriter); } xmlWriter.writeEndElement(); xmlWriter.flush(); result = baos.toString(StandardCharsets.UTF_8); - if (result.startsWith("\n")) - result = result.substring(1); + if (result.startsWith("\n")) result = result.substring(1); } catch (XMLStreamException | IOException | SEDALibException e) { result = super.toString(); } @@ -298,19 +292,25 @@ public LinkedHashMap externToCsvList(List keptMetadataLi String previousXMLElementName = null; int count = 0; for (SEDAMetadata sm : metadataList) { - if ((keptMetadataList != null) && (!keptMetadataList.contains(sm.getXmlElementName()))) - continue; + if ((keptMetadataList != null) && (!keptMetadataList.contains(sm.getXmlElementName()))) continue; if (!sm.getXmlElementName().equals(previousXMLElementName)) { previousXMLElementName = sm.getXmlElementName(); count = 0; } else count++; final String addedName; - if (isAMultiValuedMetadata(sm.getXmlElementName())) - addedName = sm.getXmlElementName() + "." + count; - else - addedName = sm.getXmlElementName(); + if (isAMultiValuedMetadata(sm.getXmlElementName())) addedName = sm.getXmlElementName() + "." + count; + else addedName = sm.getXmlElementName(); LinkedHashMap smCsvList = sm.toCsvList(); - smCsvList.entrySet().stream().forEach(e -> result.put("Content." + addedName + (e.getKey().isEmpty() ? "" : "." + e.getKey()), e.getValue())); + smCsvList + .entrySet() + .stream() + .forEach( + e -> + result.put( + "Content." + addedName + (e.getKey().isEmpty() ? "" : "." + e.getKey()), + e.getValue() + ) + ); } return result; } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java index 061e3656..cc2b897b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Coverage.java @@ -88,7 +88,6 @@ public Coverage() { */ public Coverage(String elementName, String spatial, String temporal, String juridictional) throws SEDALibException { super(elementName); - if (spatial != null) addNewMetadata("Spatial", spatial); if (temporal != null) addNewMetadata("Temporal", temporal); if (juridictional != null) addNewMetadata("Juridictional", juridictional); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java index 1af57ce3..be4f8424 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/CustodialHistory.java @@ -85,10 +85,11 @@ public CustodialHistory() { */ public CustodialHistory(Object... args) throws SEDALibException { this(); - for (int i=0;i(); - metadataMap_default.put("EventIdentifier", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap_default.put("EventIdentifier", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("EventTypeCode", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("EventType", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("EventDateTime", new ComplexListMetadataKind(DateTimeType.class, false)); metadataMap_default.put("EventDetail", new ComplexListMetadataKind(StringType.class, true)); metadataMap_default.put("Outcome", new ComplexListMetadataKind(StringType.class, false)); metadataMap_default.put("OutcomeDetail", new ComplexListMetadataKind(StringType.class, false)); - metadataMap_default.put("OutcomeDetailMessage", - new ComplexListMetadataKind(StringType.class, false)); - metadataMap_default.put("EventDetailData", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap_default.put("OutcomeDetailMessage", new ComplexListMetadataKind(StringType.class, false)); + metadataMap_default.put("EventDetailData", new ComplexListMetadataKind(StringType.class, false)); } @ComplexListMetadataMap(isExpandable = true, sedaVersion = { SedaVersion.V2_2, SedaVersion.V2_3 }) @@ -85,20 +82,16 @@ public class Event extends ComplexListType { static { metadataMap_v2 = new LinkedHashMap<>(); - metadataMap_v2.put("EventIdentifier", - new ComplexListMetadataKind(StringType.class, false)); + metadataMap_v2.put("EventIdentifier", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("EventTypeCode", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("EventType", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("EventDateTime", new ComplexListMetadataKind(DateTimeType.class, false)); metadataMap_v2.put("EventDetail", new ComplexListMetadataKind(StringType.class, true)); metadataMap_v2.put("Outcome", new ComplexListMetadataKind(StringType.class, false)); metadataMap_v2.put("OutcomeDetail", new ComplexListMetadataKind(StringType.class, false)); - metadataMap_v2.put("OutcomeDetailMessage", - new ComplexListMetadataKind(StringType.class, false)); - metadataMap_v2.put("EventDetailData", - new ComplexListMetadataKind(StringType.class, false)); - metadataMap_v2.put("LinkingAgentIdentifier", - new ComplexListMetadataKind(LinkingAgentIdentifier.class, true)); + metadataMap_v2.put("OutcomeDetailMessage", new ComplexListMetadataKind(StringType.class, false)); + metadataMap_v2.put("EventDetailData", new ComplexListMetadataKind(StringType.class, false)); + metadataMap_v2.put("LinkingAgentIdentifier", new ComplexListMetadataKind(LinkingAgentIdentifier.class, true)); } /** @@ -118,9 +111,9 @@ public Event() { * @param outcome the outcome * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public Event(String eventIdentifier, String eventType, LocalDateTime eventDateTime, String outcome) throws SEDALibException { + public Event(String eventIdentifier, String eventType, LocalDateTime eventDateTime, String outcome) + throws SEDALibException { super("Event"); - if (eventIdentifier != null) addNewMetadata("EventIdentifier", eventIdentifier); if (eventType != null) addNewMetadata("EventType", eventType); if (eventDateTime != null) addNewMetadata("EventDateTime", eventDateTime); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java index a8a8fce1..7bcb727a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Gps.java @@ -92,29 +92,24 @@ public Gps() { * @param gpsDateStamp the gps date stamp * @throws SEDALibException if sub element construction is not possible (not supposed to occur) */ - public Gps(String gpsVersionID, int gpsAltitude, String gpsLatitude, String gpsLongitude, - String gpsDateStamp) throws SEDALibException { + public Gps(String gpsVersionID, int gpsAltitude, String gpsLatitude, String gpsLongitude, String gpsDateStamp) + throws SEDALibException { this(); - if (gpsVersionID != null) addNewMetadata("GpsVersionID", gpsVersionID); if (gpsAltitude != -100000) { - if (gpsAltitude < 0) - addNewMetadata("GpsAltitudeRef", "1"); - else - addNewMetadata("GpsAltitudeRef", "0"); + if (gpsAltitude < 0) addNewMetadata("GpsAltitudeRef", "1"); + else addNewMetadata("GpsAltitudeRef", "0"); addNewMetadata("GpsAltitude", Math.abs(gpsAltitude)); } if (gpsLatitude.startsWith("-")) { gpsLatitude = gpsLatitude.substring(1); addNewMetadata("GpsLatitudeRef", "S"); - } else - addNewMetadata("GpsLatitudeRef", "N"); + } else addNewMetadata("GpsLatitudeRef", "N"); addNewMetadata("GpsLatitude", gpsLatitude); if (gpsLongitude.startsWith("-")) { gpsLongitude = gpsLongitude.substring(1); addNewMetadata("GpsLongitudeRef", "O"); - } else - addNewMetadata("GpsLongitudeRef", "E"); + } else addNewMetadata("GpsLongitudeRef", "E"); addNewMetadata("GpsLongitude", gpsLongitude); if (gpsDateStamp != null) addNewMetadata("GpsDateStamp", gpsDateStamp); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java index 781b84d2..7c9f1351 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/PersistentIdentifier.java @@ -63,7 +63,7 @@ public class PersistentIdentifier extends ComplexListType { /** * Init metadata map. */ - @ComplexListMetadataMap (sedaVersion = { SedaVersion.V2_3 }) + @ComplexListMetadataMap(sedaVersion = { SedaVersion.V2_3 }) public static final Map metadataMap; static { @@ -92,10 +92,12 @@ public PersistentIdentifier() { * @param persistentIdentifierContent the persistent identifier content * @throws SEDALibException if sub-elements construction fails (not expected to occur) */ - public PersistentIdentifier(String persistentIdentifierType, - String persistentIdentifierOrigin, - String persistentIdentifierReference, - String persistentIdentifierContent) throws SEDALibException { + public PersistentIdentifier( + String persistentIdentifierType, + String persistentIdentifierOrigin, + String persistentIdentifierReference, + String persistentIdentifierContent + ) throws SEDALibException { super("PersistentIdentifier"); if (persistentIdentifierType != null) { addNewMetadata("PersistentIdentifierType", persistentIdentifierType); @@ -122,14 +124,18 @@ public PersistentIdentifier(String persistentIdentifierType, */ public String getSummary() { List summaryList = new ArrayList<>(2); - if (getFirstNamedMetadata("PersistentIdentifierType") != null) - summaryList.add(((StringType) getFirstNamedMetadata("PersistentIdentifierType")).getValue()); - else if (getFirstNamedMetadata("PersistentIdentifierOrigin") != null) - summaryList.add(((StringType) getFirstNamedMetadata("PersistentIdentifierOrigin")).getValue()); - else if (getFirstNamedMetadata("PersistentIdentifierReference") != null) - summaryList.add(((StringType) getFirstNamedMetadata("PersistentIdentifierReference")).getValue()); - if (getFirstNamedMetadata("PersistentIdentifierContent") != null) - summaryList.add(((StringType) getFirstNamedMetadata("PersistentIdentifierContent")).getValue()); + if (getFirstNamedMetadata("PersistentIdentifierType") != null) summaryList.add( + ((StringType) getFirstNamedMetadata("PersistentIdentifierType")).getValue() + ); + else if (getFirstNamedMetadata("PersistentIdentifierOrigin") != null) summaryList.add( + ((StringType) getFirstNamedMetadata("PersistentIdentifierOrigin")).getValue() + ); + else if (getFirstNamedMetadata("PersistentIdentifierReference") != null) summaryList.add( + ((StringType) getFirstNamedMetadata("PersistentIdentifierReference")).getValue() + ); + if (getFirstNamedMetadata("PersistentIdentifierContent") != null) summaryList.add( + ((StringType) getFirstNamedMetadata("PersistentIdentifierContent")).getValue() + ); return String.join(" : ", summaryList); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java index 98ba9a77..1bb3c0e6 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/ReferencedObject.java @@ -82,7 +82,6 @@ public ReferencedObject() { */ public ReferencedObject(String signedObjectId, String signedObjectDigest) throws SEDALibException { this(); - addNewMetadata("SignedObjectId", signedObjectId); addNewMetadata("SignedObjectDigest", signedObjectDigest); } @@ -95,10 +94,10 @@ public ReferencedObject(String signedObjectId, String signedObjectDigest) throws * @param signedObjectDigestAlgorithm the signed object digest algorithm * @throws SEDALibException if sub element construction is not possible (not supposed to occur) */ - public ReferencedObject(String signedObjectId, String signedObjectDigest, String signedObjectDigestAlgorithm) throws SEDALibException { + public ReferencedObject(String signedObjectId, String signedObjectDigest, String signedObjectDigestAlgorithm) + throws SEDALibException { this(); - addNewMetadata("SignedObjectId", signedObjectId); - addNewMetadata("SignedObjectDigest", signedObjectDigest,signedObjectDigestAlgorithm); + addNewMetadata("SignedObjectDigest", signedObjectDigest, signedObjectDigestAlgorithm); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java index 1bfa9921..954a5437 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/RelatedObjectReference.java @@ -88,7 +88,6 @@ public RelatedObjectReference() { */ public RelatedObjectReference(String signedObjectID, String signedObjectDigest) throws SEDALibException { this(); - addNewMetadata("SignedObjectID", signedObjectID); addNewMetadata("SignedObjectDigest", signedObjectDigest); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java index 5ee9df17..a9cd5450 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Rule.java @@ -95,8 +95,10 @@ public Rule(String ruleID, LocalDate startDate) { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeElementValue("Rule", ruleID); - if (startDate != null) - xmlWriter.writeElementValue("StartDate", SEDAXMLStreamWriter.getStringFromDate(startDate)); + if (startDate != null) xmlWriter.writeElementValue( + "StartDate", + SEDAXMLStreamWriter.getStringFromDate(startDate) + ); } catch (XMLStreamException e) { throw new SEDALibException("Erreur d'écriture XML dans un élément de règle dans RuleType", e); } @@ -117,8 +119,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { public LinkedHashMap toCsvList(int i) throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); result.put("Rule." + i, ruleID); - if (startDate != null) - result.put("StartDate." + i, SEDAXMLStreamWriter.getStringFromDate(startDate)); + if (startDate != null) result.put("StartDate." + i, SEDAXMLStreamWriter.getStringFromDate(startDate)); return result; } @@ -136,8 +137,7 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep tmp = xmlReader.nextValueIfNamed("Rule"); if (tmp != null) { tmpDate = xmlReader.nextValueIfNamed("StartDate"); - if (tmpDate == null) - curStartDate = null; + if (tmpDate == null) curStartDate = null; else try { curStartDate = SEDAXMLEventReader.getDateFromString(tmpDate); } catch (DateTimeParseException e) { @@ -145,10 +145,7 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep } this.ruleID = tmp; this.startDate = curStartDate; - - - } else - return false; + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de règle dans RuleType", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java index 89275acc..a81be5dc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SignatureDescription.java @@ -92,17 +92,27 @@ public SignatureDescription() { * @param signingType the type of signing * @throws SEDALibException if sub-elements construction fails */ - public SignatureDescription(String signerFirstName, String signerBirthName, LocalDateTime signingTime, String signerIdentifier, - String validatorCorpname, LocalDateTime validationTime, String signingType) throws SEDALibException { + public SignatureDescription( + String signerFirstName, + String signerBirthName, + LocalDateTime signingTime, + String signerIdentifier, + String validatorCorpname, + LocalDateTime validationTime, + String signingType + ) throws SEDALibException { super("SignatureDescription"); Signer signer = null; Validator validator = null; - if (signerFirstName != null || signerBirthName != null || signingTime != null && signerIdentifier != null) - addNewMetadata("Signer", signerFirstName, signerBirthName, signingTime, signerIdentifier); - if (validatorCorpname != null || validationTime != null) - addNewMetadata("Validator", validatorCorpname, validationTime); - if (signingType != null) - addNewMetadata("SigningType", signingType); + if ( + signerFirstName != null || signerBirthName != null || (signingTime != null && signerIdentifier != null) + ) addNewMetadata("Signer", signerFirstName, signerBirthName, signingTime, signerIdentifier); + if (validatorCorpname != null || validationTime != null) addNewMetadata( + "Validator", + validatorCorpname, + validationTime + ); + if (signingType != null) addNewMetadata("SigningType", signingType); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java index 0ee85db2..db262a29 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/Signer.java @@ -55,11 +55,11 @@ */ public class Signer extends ComplexListType { - static final String FIRSTNAME_TAG="FirstName"; - static final String BIRTHNAME_TAG="BirthName"; - static final String FULLNAME_TAG="FullName"; - static final String IDENTIFIER_TAG="Identifier"; - static final String SIGNINGTIME_TAG="SigningTime"; + static final String FIRSTNAME_TAG = "FirstName"; + static final String BIRTHNAME_TAG = "BirthName"; + static final String FULLNAME_TAG = "FullName"; + static final String IDENTIFIER_TAG = "Identifier"; + static final String SIGNINGTIME_TAG = "SigningTime"; /** * Init metadata map. @@ -105,7 +105,6 @@ public Signer() { */ public Signer(String fullName, LocalDateTime signingTime) throws SEDALibException { this(); - addNewMetadata(FULLNAME_TAG, fullName); addNewMetadata(SIGNINGTIME_TAG, signingTime); } @@ -120,7 +119,6 @@ public Signer(String fullName, LocalDateTime signingTime) throws SEDALibExceptio */ public Signer(String firstName, String birthName, LocalDateTime signingTime) throws SEDALibException { this(); - addNewMetadata(FIRSTNAME_TAG, firstName); addNewMetadata(BIRTHNAME_TAG, birthName); addNewMetadata(SIGNINGTIME_TAG, signingTime); @@ -135,9 +133,9 @@ public Signer(String firstName, String birthName, LocalDateTime signingTime) thr * @param signingTime the signing time * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public Signer(String firstName, String birthName, LocalDateTime signingTime, String identifier) throws SEDALibException { + public Signer(String firstName, String birthName, LocalDateTime signingTime, String identifier) + throws SEDALibException { this(); - addNewMetadata(FIRSTNAME_TAG, firstName); addNewMetadata(BIRTHNAME_TAG, birthName); addNewMetadata(IDENTIFIER_TAG, identifier); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java index f5254735..1668fc4f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/SigningInformation.java @@ -94,17 +94,35 @@ public SigningInformation() { * @param signingType the type of the signature * @throws SEDALibException if sub-elements construction fails */ - public SigningInformation(String signingRole, String sipInternalID, String signerFirstName, String signerBirthName, LocalDateTime signingTime, String signerIdentifier, - String signingType) throws SEDALibException { + public SigningInformation( + String signingRole, + String sipInternalID, + String signerFirstName, + String signerBirthName, + LocalDateTime signingTime, + String signerIdentifier, + String signingType + ) throws SEDALibException { super("SigningInformation"); - - if (signingRole != null) addNewMetadata("SigningRole", signingRole); if (sipInternalID != null) addNewMetadata("SignedDocumentReferenceId", sipInternalID); - if (signerFirstName != null || - signerBirthName != null || signingTime != null || signerIdentifier != null || - signingType != null) { - addNewMetadata("SignatureDescription", signerFirstName, signerBirthName, signingTime, signerIdentifier, null, null, signingType); + if ( + signerFirstName != null || + signerBirthName != null || + signingTime != null || + signerIdentifier != null || + signingType != null + ) { + addNewMetadata( + "SignatureDescription", + signerFirstName, + signerBirthName, + signingTime, + signerIdentifier, + null, + null, + signingType + ); } if (signingTime != null) addNewMetadata("TimestampingInformation", signingTime, null); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java index d077cc98..7dffa98b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/TimestampingInformation.java @@ -83,12 +83,13 @@ public TimestampingInformation() { * @param additionalTimestampingInformation additional information about timestamping * @throws SEDALibException if sub-elements construction fails (not expected to occur) */ - public TimestampingInformation(LocalDateTime timeStamp, String additionalTimestampingInformation) throws SEDALibException { + public TimestampingInformation(LocalDateTime timeStamp, String additionalTimestampingInformation) + throws SEDALibException { super("TimestampingInformation"); - - if (timeStamp != null) - addNewMetadata("TimeStamp", timeStamp); - if (additionalTimestampingInformation != null) - addNewMetadata("AdditionalTimestampingInformation", additionalTimestampingInformation); + if (timeStamp != null) addNewMetadata("TimeStamp", timeStamp); + if (additionalTimestampingInformation != null) addNewMetadata( + "AdditionalTimestampingInformation", + additionalTimestampingInformation + ); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java index 8c876359..ec6b5695 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/content/package-info.java @@ -39,4 +39,4 @@ * Package for SEDA specific Content, with serialization to and * deserilization from XML */ -package fr.gouv.vitam.tools.sedalib.metadata.content; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.metadata.content; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java index 644c8858..26b52dac 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FileInfo.java @@ -95,15 +95,25 @@ public FileInfo() { * @param lastModified the last modified * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public FileInfo(String filename, String creatingApplicationName, String creatingApplicationVersion, - LocalDateTime dateCreatedByApplication, String creatingOs, String creatingOsVersion, FileTime lastModified) throws SEDALibException { + public FileInfo( + String filename, + String creatingApplicationName, + String creatingApplicationVersion, + LocalDateTime dateCreatedByApplication, + String creatingOs, + String creatingOsVersion, + FileTime lastModified + ) throws SEDALibException { super("FileInfo"); - if (filename!=null) addNewMetadata("Filename", filename); - if (creatingApplicationName!=null) addNewMetadata("CreatingApplicationName", creatingApplicationName); - if (creatingApplicationVersion!=null) addNewMetadata("CreatingApplicationVersion", creatingApplicationVersion); - if (dateCreatedByApplication!=null) addNewMetadata("DateCreatedByApplication", dateCreatedByApplication); - if (creatingOs!=null) addNewMetadata("CreatingOs", creatingOs); - if (creatingOsVersion!=null) addNewMetadata("CreatingOsVersion", creatingOsVersion); - if (lastModified!=null) addNewMetadata("LastModified", lastModified.toString()); + if (filename != null) addNewMetadata("Filename", filename); + if (creatingApplicationName != null) addNewMetadata("CreatingApplicationName", creatingApplicationName); + if (creatingApplicationVersion != null) addNewMetadata( + "CreatingApplicationVersion", + creatingApplicationVersion + ); + if (dateCreatedByApplication != null) addNewMetadata("DateCreatedByApplication", dateCreatedByApplication); + if (creatingOs != null) addNewMetadata("CreatingOs", creatingOs); + if (creatingOsVersion != null) addNewMetadata("CreatingOsVersion", creatingOsVersion); + if (lastModified != null) addNewMetadata("LastModified", lastModified.toString()); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java index b64c41da..a67668ed 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/FormatIdentification.java @@ -88,11 +88,12 @@ public FormatIdentification() { * @param encoding the encoding * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public FormatIdentification(String formatLitteral, String mimeType, String formatId, String encoding) throws SEDALibException { + public FormatIdentification(String formatLitteral, String mimeType, String formatId, String encoding) + throws SEDALibException { super("FormatIdentification"); - if ((formatLitteral!=null) && !formatLitteral.isEmpty()) addNewMetadata("FormatLitteral",formatLitteral); - if ((mimeType!=null) && !mimeType.isEmpty()) addNewMetadata("MimeType", mimeType); - if ((formatId!=null) && !formatId.isEmpty()) addNewMetadata("FormatId", formatId); - if ((encoding!=null) && !encoding.isEmpty()) addNewMetadata("Encoding", encoding); + if ((formatLitteral != null) && !formatLitteral.isEmpty()) addNewMetadata("FormatLitteral", formatLitteral); + if ((mimeType != null) && !mimeType.isEmpty()) addNewMetadata("MimeType", mimeType); + if ((formatId != null) && !formatId.isEmpty()) addNewMetadata("FormatId", formatId); + if ((encoding != null) && !encoding.isEmpty()) addNewMetadata("Encoding", encoding); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java index 075eabcc..d7e1e773 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Relationship.java @@ -37,7 +37,6 @@ */ package fr.gouv.vitam.tools.sedalib.metadata.data; -import com.fasterxml.jackson.annotation.JsonIgnore; import fr.gouv.vitam.tools.sedalib.metadata.namedtype.NamedTypeMetadata; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import fr.gouv.vitam.tools.sedalib.xml.SEDAXMLEventReader; @@ -54,6 +53,7 @@ * For Relationship empty tag with link annotations. */ public class Relationship extends NamedTypeMetadata { + /** * The target reference. */ @@ -68,16 +68,16 @@ public class Relationship extends NamedTypeMetadata { * Instantiates a new Relationship. */ public Relationship() { - this( null, null); + this(null, null); } - /** + /** * Instantiates a new Relationship. * * @param target the target reference */ public Relationship(String target) { - this( target, null); + this(target, null); } /** @@ -86,7 +86,7 @@ public Relationship(String target) { * @param target the target reference * @param type the relationship type */ - public Relationship( String target, String type) { + public Relationship(String target, String type) { super("Relationship"); this.target = target; this.type = type; @@ -103,10 +103,8 @@ public Relationship( String target, String type) { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeStartElement(elementName); - if (target != null) - xmlWriter.writeAttribute("xml:target", target); - if (type != null) - xmlWriter.writeAttribute("xml:type", type); + if (target != null) xmlWriter.writeAttribute("xml:target", target); + if (type != null) xmlWriter.writeAttribute("xml:type", type); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { throw new SEDALibException("Erreur d'écriture XML dans un élément de type Relationship", e); @@ -121,10 +119,8 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - if (target != null) - result.put("attr", "xml:target=\"" + target + "\""); - if (type != null) - result.put("attr", "xml:type=\"" + type + "\""); + if (target != null) result.put("attr", "xml:target=\"" + target + "\""); + if (type != null) result.put("attr", "xml:type=\"" + type + "\""); return result; } @@ -142,10 +138,10 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep type = xmlReader.peekAttribute(XMLConstants.XML_NS_URI, "type"); xmlReader.nextUsefullEvent(); XMLEvent event = xmlReader.nextUsefullEvent(); - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type TextType", e); } @@ -170,7 +166,7 @@ public String getType() { return type; } - /** + /** * Sets the target reference. * * @param target the target reference to set @@ -187,4 +183,4 @@ public void setTarget(String target) { public void setType(String type) { this.type = type; } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java index acf283df..291d19bb 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/Weight.java @@ -59,7 +59,16 @@ public class Weight extends NamedTypeMetadata { /** * Enum restricted values. */ - public static final List enumValues = Arrays.asList("microgram","MC","milligram","MGM","gram","GRM","kilogram","KGM"); + public static final List enumValues = Arrays.asList( + "microgram", + "MC", + "milligram", + "MGM", + "gram", + "GRM", + "kilogram", + "KGM" + ); /** * The value. @@ -100,8 +109,9 @@ public Weight(Double value) throws SEDALibException { public Weight(Double value, String unit) throws SEDALibException { super("Weight"); this.value = value; - if ((unit!=null) && !enumValues.contains(unit)) - throw new SEDALibException("["+unit+"] n'est pas une unité de mesure linéraire"); + if ((unit != null) && !enumValues.contains(unit)) throw new SEDALibException( + "[" + unit + "] n'est pas une unité de mesure linéraire" + ); this.unit = unit; } @@ -116,10 +126,8 @@ public Weight(Double value, String unit) throws SEDALibException { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeStartElement(elementName); - if (unit != null) - xmlWriter.writeAttribute("unit", unit); - if (value!=null) - xmlWriter.writeCharactersIfNotEmpty(Double.toString(value)); + if (unit != null) xmlWriter.writeAttribute("unit", unit); + if (value != null) xmlWriter.writeCharactersIfNotEmpty(Double.toString(value)); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { throw new SEDALibException("Erreur d'écriture XML dans un élément de type Weight", e); @@ -136,8 +144,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); if (value != null) { result.put("", value.toString()); - if (unit != null) - result.put("attr", "unit=\"" + unit + "\""); + if (unit != null) result.put("attr", "unit=\"" + unit + "\""); } return result; } @@ -158,12 +165,11 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (event.isCharacters()) { value = Double.parseDouble(event.asCharacters().getData()); event = xmlReader.nextUsefullEvent(); - } else - value = null; - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = null; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type Weight", e); } @@ -208,8 +214,9 @@ public void setValue(Double value) { * @throws SEDALibException if unknown measure unit */ public void setUnit(String unit) throws SEDALibException { - if ((unit!=null) && !enumValues.contains(unit)) - throw new SEDALibException("["+unit+"] n'est pas une unité de mesure de poids"); + if ((unit != null) && !enumValues.contains(unit)) throw new SEDALibException( + "[" + unit + "] n'est pas une unité de mesure de poids" + ); this.unit = unit; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java index 5cb34358..7689a47b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/data/package-info.java @@ -39,4 +39,4 @@ * Package for SEDA specific DataObject, with serialization to and * deserilization from XML */ -package fr.gouv.vitam.tools.sedalib.metadata.data; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.metadata.data; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java index 0e424505..fc5c2396 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AccessRule.java @@ -56,13 +56,14 @@ */ public class AccessRule extends RuleType { - static final String ACCESSRULE_TAG="AccessRule"; + static final String ACCESSRULE_TAG = "AccessRule"; /** * Init metadata map. */ @ComplexListMetadataMap public static final Map metadataMap; + static { metadataMap = new LinkedHashMap<>(); metadataMap.put(RULE_TAG, new ComplexListMetadataKind(Rule.class, true)); @@ -85,6 +86,6 @@ public AccessRule() { * @throws SEDALibException the seda lib exception */ public AccessRule(String rule, LocalDate startDate) throws SEDALibException { - super(ACCESSRULE_TAG, rule , startDate); + super(ACCESSRULE_TAG, rule, startDate); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java index cf7b1279..204945aa 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/AppraisalRule.java @@ -58,7 +58,7 @@ */ public class AppraisalRule extends RuleType { - static final String APPRAISALRULE_TAG="AppraisalRule"; + static final String APPRAISALRULE_TAG = "AppraisalRule"; /** * Init metadata map. @@ -100,7 +100,7 @@ public AppraisalRule() { * @throws SEDALibException the seda lib exception */ public AppraisalRule(String rule, LocalDate startDate) throws SEDALibException { - super(APPRAISALRULE_TAG, rule , startDate); + super(APPRAISALRULE_TAG, rule, startDate); } /** diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java index ec2df58d..6d906b6c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ArchiveUnitIdentifierKey.java @@ -57,8 +57,8 @@ */ public class ArchiveUnitIdentifierKey extends ComplexListType { - static final String METADATANAME="MetadataName"; - static final String METADATAVALUE="MetadataValue"; + static final String METADATANAME = "MetadataName"; + static final String METADATAVALUE = "MetadataValue"; /** * Init metadata map. @@ -88,7 +88,7 @@ public ArchiveUnitIdentifierKey() { */ public ArchiveUnitIdentifierKey(String metadataName, String metadataValue) throws SEDALibException { this(); - addNewMetadata(METADATANAME, metadataName); - addNewMetadata(METADATAVALUE, metadataValue); - } + addNewMetadata(METADATANAME, metadataName); + addNewMetadata(METADATAVALUE, metadataValue); + } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java index 4e8ffa70..6f9711c4 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ClassificationRule.java @@ -55,15 +55,16 @@ */ public class ClassificationRule extends RuleType { - static final String CLASSIFICATIONRULE_TAG="ClassificationRule"; - static final String CLASSIFICATIONLEVEL_TAG="ClassificationLevel"; - static final String CLASSIFICATIONOWNER_TAG="ClassificationOwner"; + static final String CLASSIFICATIONRULE_TAG = "ClassificationRule"; + static final String CLASSIFICATIONLEVEL_TAG = "ClassificationLevel"; + static final String CLASSIFICATIONOWNER_TAG = "ClassificationOwner"; /** * Init metadata map. */ @ComplexListMetadataMap public static final Map metadataMap; + static { metadataMap = new LinkedHashMap<>(); metadataMap.put(RULE_TAG, new ComplexListMetadataKind(Rule.class, true)); @@ -94,7 +95,7 @@ public ClassificationRule() { */ public ClassificationRule(String classificationLevel, String classificationOwner) throws SEDALibException { this(); - addNewMetadata(CLASSIFICATIONLEVEL_TAG,classificationLevel); - addNewMetadata(CLASSIFICATIONOWNER_TAG,classificationOwner); + addNewMetadata(CLASSIFICATIONLEVEL_TAG, classificationLevel); + addNewMetadata(CLASSIFICATIONOWNER_TAG, classificationOwner); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java index 5223676f..28ea593e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/DisseminationRule.java @@ -56,7 +56,7 @@ */ public class DisseminationRule extends RuleType { - static final String DISSEMINATIONRULE_TAG="DisseminationRule"; + static final String DISSEMINATIONRULE_TAG = "DisseminationRule"; /** * Init metadata map. @@ -86,6 +86,6 @@ public DisseminationRule() { * @throws SEDALibException the seda lib exception */ public DisseminationRule(String rule, LocalDate startDate) throws SEDALibException { - super(DISSEMINATIONRULE_TAG, rule , startDate); + super(DISSEMINATIONRULE_TAG, rule, startDate); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java index 03b9bb2a..485713fc 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/HoldRule.java @@ -56,12 +56,12 @@ */ public class HoldRule extends RuleType { - static final String HOLDRULE_TAG="HoldRule"; - static final String HOLDENDDATE_TAG="HoldEndDate"; - static final String HOLDOWNER_TAG="HoldOwner"; - static final String HOLDREASSESSINGDATE_TAG="HoldReassessingDate"; - static final String HOLDREASON_TAG="HoldReason"; - static final String HOLDPREVENTREARRANGEMENT_TAG="PreventRearrangement"; + static final String HOLDRULE_TAG = "HoldRule"; + static final String HOLDENDDATE_TAG = "HoldEndDate"; + static final String HOLDOWNER_TAG = "HoldOwner"; + static final String HOLDREASSESSINGDATE_TAG = "HoldReassessingDate"; + static final String HOLDREASON_TAG = "HoldReason"; + static final String HOLDPREVENTREARRANGEMENT_TAG = "PreventRearrangement"; /** * Init metadata map. diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java index 5998e07a..a871079e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/LogBook.java @@ -57,7 +57,7 @@ */ public class LogBook extends ComplexListType { - static final String EVENT_TAG="Event"; + static final String EVENT_TAG = "Event"; /** * Init metadata map. @@ -85,10 +85,11 @@ public LogBook() { */ public LogBook(Object... args) throws SEDALibException { this(); - for (int i=0;i externToCsvList() throws SEDALibException { count = 0; } else count++; final String addedName; - if (isAMultiValuedMetadata(sm.getXmlElementName())) - addedName = sm.getXmlElementName() + "." + count; - else - addedName = sm.getXmlElementName(); + if (isAMultiValuedMetadata(sm.getXmlElementName())) addedName = sm.getXmlElementName() + "." + count; + else addedName = sm.getXmlElementName(); LinkedHashMap smCsvList = sm.toCsvList(); - smCsvList.entrySet().stream().forEach(e -> result.put("Management."+addedName + (e.getKey().isEmpty() ? "" : "." + e.getKey()), e.getValue())); + smCsvList + .entrySet() + .stream() + .forEach( + e -> + result.put( + "Management." + addedName + (e.getKey().isEmpty() ? "" : "." + e.getKey()), + e.getValue() + ) + ); } return result; } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java index 625d430e..970e98ea 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/ReuseRule.java @@ -56,7 +56,7 @@ */ public class ReuseRule extends RuleType { - static final String REUSERULE_TAG="ReuseRule"; + static final String REUSERULE_TAG = "ReuseRule"; /** * Init metadata map. @@ -86,6 +86,6 @@ public ReuseRule() { * @throws SEDALibException the seda lib exception */ public ReuseRule(String rule, LocalDate startDate) throws SEDALibException { - super(REUSERULE_TAG, rule , startDate); + super(REUSERULE_TAG, rule, startDate); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java index a5fd2f4e..e31cc1f4 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/StorageRule.java @@ -58,7 +58,7 @@ */ public class StorageRule extends RuleType { - static final String STORAGERULE_TAG="StorageRule"; + static final String STORAGERULE_TAG = "StorageRule"; /** * Init metadata map. @@ -77,8 +77,7 @@ public class StorageRule extends RuleType { /** * The final action list. */ - protected static -List finalActionList; + protected static List finalActionList; static { finalActionList = new ArrayList<>(); @@ -102,7 +101,7 @@ public StorageRule() { * @throws SEDALibException the seda lib exception */ public StorageRule(String rule, LocalDate startDate) throws SEDALibException { - super(STORAGERULE_TAG, rule , startDate); + super(STORAGERULE_TAG, rule, startDate); } /** diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java index ab9a3224..ce35e8ac 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/UpdateOperation.java @@ -57,18 +57,22 @@ */ public class UpdateOperation extends ComplexListType { - static final String SYSTEMID_TAG="SystemId"; - static final String ARCHIVEUNITIDENTIFIERKEY_TAG="ArchiveUnitIdentifierKey"; + static final String SYSTEMID_TAG = "SystemId"; + static final String ARCHIVEUNITIDENTIFIERKEY_TAG = "ArchiveUnitIdentifierKey"; /** * Init metadata map. */ @ComplexListMetadataMap public static final Map metadataMap; + static { metadataMap = new LinkedHashMap<>(); metadataMap.put(SYSTEMID_TAG, new ComplexListMetadataKind(StringType.class, false)); - metadataMap.put(ARCHIVEUNITIDENTIFIERKEY_TAG, new ComplexListMetadataKind(ArchiveUnitIdentifierKey.class, false)); + metadataMap.put( + ARCHIVEUNITIDENTIFIERKEY_TAG, + new ComplexListMetadataKind(ArchiveUnitIdentifierKey.class, false) + ); } /** @@ -86,8 +90,8 @@ public UpdateOperation() { */ public UpdateOperation(String systemId) throws SEDALibException { this(); - addNewMetadata(SYSTEMID_TAG, systemId); - } + addNewMetadata(SYSTEMID_TAG, systemId); + } /** * Instantiates a new update operation with a metadata name and value link. @@ -98,6 +102,6 @@ public UpdateOperation(String systemId) throws SEDALibException { */ public UpdateOperation(String metadataName, String metadataValue) throws SEDALibException { this(); - addNewMetadata(ARCHIVEUNITIDENTIFIERKEY_TAG, metadataName, metadataValue); + addNewMetadata(ARCHIVEUNITIDENTIFIERKEY_TAG, metadataName, metadataValue); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java index d1a10087..b934cf7a 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/management/package-info.java @@ -39,4 +39,4 @@ * Package for SEDA specific Management, with serialization to and * deserilization from XML */ -package fr.gouv.vitam.tools.sedalib.metadata.management; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.metadata.management; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java index a6eb75a4..4392ed76 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgencyType.java @@ -49,7 +49,7 @@ */ public class AgencyType extends ComplexListType { - static final String IDENTIFIER_TAG="Identifier"; + static final String IDENTIFIER_TAG = "Identifier"; /** * Init metadata map. @@ -81,6 +81,6 @@ public AgencyType(String elementName) { */ public AgencyType(String elementName, String identifier) throws SEDALibException { super(elementName); - addNewMetadata(IDENTIFIER_TAG, identifier); + addNewMetadata(IDENTIFIER_TAG, identifier); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java index d22610fc..7397dc32 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AgentType.java @@ -49,10 +49,10 @@ */ public class AgentType extends ComplexListType { - static final String FIRSTNAME_TAG="FirstName"; - static final String BIRTHNAME_TAG="BirthName"; - static final String FULLNAME_TAG="FullName"; - static final String IDENTIFIER_TAG="Identifier"; + static final String FIRSTNAME_TAG = "FirstName"; + static final String BIRTHNAME_TAG = "BirthName"; + static final String FULLNAME_TAG = "FullName"; + static final String IDENTIFIER_TAG = "Identifier"; /** * Init metadata map. @@ -99,7 +99,6 @@ public AgentType(String elementName) { */ public AgentType(String elementName, String fullName) throws SEDALibException { super(elementName); - addNewMetadata(FULLNAME_TAG, fullName); } @@ -113,7 +112,6 @@ public AgentType(String elementName, String fullName) throws SEDALibException { */ public AgentType(String elementName, String firstName, String birthName) throws SEDALibException { super(elementName); - addNewMetadata(FIRSTNAME_TAG, firstName); addNewMetadata(BIRTHNAME_TAG, birthName); } @@ -127,9 +125,9 @@ public AgentType(String elementName, String firstName, String birthName) throws * @param identifier the identifier * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public AgentType(String elementName, String firstName, String birthName, String identifier) throws SEDALibException { + public AgentType(String elementName, String firstName, String birthName, String identifier) + throws SEDALibException { super(elementName); - addNewMetadata(FIRSTNAME_TAG, firstName); addNewMetadata(BIRTHNAME_TAG, birthName); addNewMetadata(IDENTIFIER_TAG, identifier); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java index 1dbf3d33..da065b67 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLListType.java @@ -93,8 +93,10 @@ public AnyXMLListType(String elementName) { */ public AnyXMLListType(String elementName, String rawXmlList) throws SEDALibException { super(elementName); - try (ByteArrayInputStream bais = new ByteArrayInputStream(rawXmlList.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(rawXmlList.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { // jump StartDocument xmlReader.nextUsefullEvent(); String tmp = xmlReader.peekName(); @@ -104,8 +106,7 @@ public AnyXMLListType(String elementName, String rawXmlList) throws SEDALibExcep tmp = xmlReader.peekName(); } XMLEvent event = xmlReader.xmlReader.peek(); - if (!event.isEndDocument()) - throw new SEDALibException("Il y a des champs illégaux"); + if (!event.isEndDocument()) throw new SEDALibException("Il y a des champs illégaux"); } catch (XMLStreamException | SEDALibException | IOException e) { throw new SEDALibException("Erreur de lecture de [" + elementName + "]", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java index 05903c5b..1e09b8b7 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/AnyXMLType.java @@ -94,7 +94,10 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeRawXMLBlockIfNotEmpty(rawXml); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type AnyXMLType ["+getXmlElementName()+"]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type AnyXMLType [" + getXmlElementName() + "]", + e + ); } } @@ -106,7 +109,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - result.put("",rawXml); + result.put("", rawXml); return result; } @@ -123,8 +126,7 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep elementName = event.asStartElement().getName().getLocalPart(); rawXml = xmlReader.nextBlockAsStringIfNamed(elementName); } catch (XMLStreamException | IllegalArgumentException e) { - throw new SEDALibException( - "Erreur de lecture XML dans un élément de type AnyXMLType", e); + throw new SEDALibException("Erreur de lecture XML dans un élément de type AnyXMLType", e); } return true; } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java index 4819db7d..7da70038 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/BooleanType.java @@ -96,11 +96,13 @@ public BooleanType(String elementName, Boolean value) { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { String tmp = null; try { - if (value != null) - tmp = value.toString(); + if (value != null) tmp = value.toString(); xmlWriter.writeElementValue(elementName, tmp); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type BooleanType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type BooleanType [" + getXmlElementName() + "]", + e + ); } } @@ -113,10 +115,8 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { public LinkedHashMap toCsvList() throws SEDALibException { String tmp = null; LinkedHashMap result = new LinkedHashMap<>(); - if (value != null) - tmp = value.toString(); - else - tmp = ""; + if (value != null) tmp = value.toString(); + else tmp = ""; result.put("", tmp); return result; } @@ -136,20 +136,15 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep XMLEvent event = xmlReader.nextUsefullEvent(); if (event.isCharacters()) { tmp = event.asCharacters().getData(); - if (tmp.equals("true")) - value = true; - else if (tmp.equals("false")) - value = false; - else - throw new SEDALibException(tmp + " n'est pas une valeur autorisée"); + if (tmp.equals("true")) value = true; + else if (tmp.equals("false")) value = false; + else throw new SEDALibException(tmp + " n'est pas une valeur autorisée"); event = xmlReader.nextUsefullEvent(); - } else - value = null; - if ((!event.isEndElement()) - || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = null; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type BooleanType", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java index 674388fb..84a323f1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListInterface.java @@ -86,8 +86,6 @@ * */ public interface ComplexListInterface { - - /** * Gets list of fields with ComplexListMetadataMap annotation. *

    @@ -97,7 +95,7 @@ public interface ComplexListInterface { * @param targetClass the class to analyze * @return list of fields having ComplexListMetadataMap annotation */ - static private List getFieldsWithAnnotationComplexListMetadataMap(Class targetClass) { + private static List getFieldsWithAnnotationComplexListMetadataMap(Class targetClass) { List result = new ArrayList<>(); for (Field field : targetClass.getDeclaredFields()) { if (field.isAnnotationPresent(ComplexListMetadataMap.class)) { @@ -116,9 +114,7 @@ static private List getFieldsWithAnnotationComplexListMetadataMap(Class getSedaVersions(ComplexListMetadataMap annotation) { SedaVersion[] explicit = annotation.sedaVersion(); - return explicit.length == 0 - ? Arrays.asList(SedaVersion.values()) - : Arrays.asList(explicit); + return explicit.length == 0 ? Arrays.asList(SedaVersion.values()) : Arrays.asList(explicit); } /** @@ -145,9 +141,9 @@ private static List getSedaVersions(ComplexListMetadataMap annotati * @throws RuntimeException if metadata initialization fails due to reflection errors */ static void initMetadataMaps( - Class targetClass, - Map> versionedMetadataDefinitions, - Map versionedNotExpandableFlags + Class targetClass, + Map> versionedMetadataDefinitions, + Map versionedNotExpandableFlags ) { try { List annotatedFields = getFieldsWithAnnotationComplexListMetadataMap(targetClass); @@ -155,8 +151,10 @@ static void initMetadataMaps( ComplexListMetadataMap ann = field.getAnnotation(ComplexListMetadataMap.class); @SuppressWarnings("unchecked") - LinkedHashMap map = - (LinkedHashMap) field.get(null); + LinkedHashMap map = (LinkedHashMap< + String, + ComplexListMetadataKind + >) field.get(null); boolean isExpandable = ann.isExpandable(); for (SedaVersion version : getSedaVersions(ann)) { @@ -166,7 +164,9 @@ static void initMetadataMaps( } } catch (ReflectiveOperationException | ClassCastException e) { throw new RuntimeException( - "Erreur d'initialisation des metadata pour la classe " + targetClass.getName(), e); + "Erreur d'initialisation des metadata pour la classe " + targetClass.getName(), + e + ); } } @@ -179,16 +179,17 @@ static Map> metadataDefinition ComplexListMetadataMap ann = field.getAnnotation(ComplexListMetadataMap.class); @SuppressWarnings("unchecked") - LinkedHashMap map = - (LinkedHashMap) field.get(null); + LinkedHashMap map = (LinkedHashMap< + String, + ComplexListMetadataKind + >) field.get(null); for (SedaVersion version : getSedaVersions(ann)) { versionedMetadataDefinitions.put(version, map); } } } catch (ReflectiveOperationException | ClassCastException e) { - throw new RuntimeException( - "Erreur d'initialisation des metadata pour la classe " + clazz.getName(), e); + throw new RuntimeException("Erreur d'initialisation des metadata pour la classe " + clazz.getName(), e); } return versionedMetadataDefinitions; @@ -207,8 +208,7 @@ static Map notExpandableFlags(Class clazz) { } } } catch (ClassCastException e) { - throw new RuntimeException( - "Erreur d'initialisation des metadata pour la classe " + clazz.getName(), e); + throw new RuntimeException("Erreur d'initialisation des metadata pour la classe " + clazz.getName(), e); } return versionedNotExpandableFlags; @@ -222,20 +222,24 @@ static Map notExpandableFlags(Class clazz) { * @return the metadata map * @throws SEDALibException if the @ComplexListMetadataMap annotated static variable doesn't exist or is badly formed */ - static Map getMetadataMap(Class complexListTypeMetadataClass) throws SEDALibException { - final Map> metadataDefinitions = ComplexListInterface - .metadataDefinitions(complexListTypeMetadataClass); + static Map getMetadataMap(Class complexListTypeMetadataClass) + throws SEDALibException { + final Map> metadataDefinitions = + ComplexListInterface.metadataDefinitions(complexListTypeMetadataClass); if (metadataDefinitions.containsKey(SedaContext.getVersion())) { return metadataDefinitions.get(SedaContext.getVersion()); } - return metadataDefinitions.values().stream() + return metadataDefinitions + .values() + .stream() .findFirst() .orElseThrow(() -> { - final String errorMessage = "Le type " - + complexListTypeMetadataClass.getName() - + " ne dispose pas de définitions seda versionnée"; + final String errorMessage = + "Le type " + + complexListTypeMetadataClass.getName() + + " ne dispose pas de définitions seda versionnée"; return new SEDALibException(errorMessage); }); @@ -248,8 +252,9 @@ static Map getMetadataMap(Class complexListT * @return true, if is not expendable */ static Boolean isNotExpandable(Class complexListTypeMetadataClass) { - final Map notExpandableFlags = ComplexListInterface - .notExpandableFlags(complexListTypeMetadataClass); + final Map notExpandableFlags = ComplexListInterface.notExpandableFlags( + complexListTypeMetadataClass + ); if (notExpandableFlags.containsKey(SedaContext.getVersion())) { return notExpandableFlags.get(SedaContext.getVersion()); @@ -308,25 +313,16 @@ static Boolean isNotExpandable(Class complexListTypeMetadataClass) { * @param type the class type to wrap * @return the wrapped class type for primitives, or the original type if not primitive */ - static private Class wrapPrimitives(Class type) { - if (!type.isPrimitive()) - return type; - if (type == int.class) - return (Integer.class); - if (type == long.class) - return (Long.class); - if (type == double.class) - return (Double.class); - if (type == float.class) - return (Float.class); - if (type == boolean.class) - return (Boolean.class); - if (type == char.class) - return (Character.class); - if (type == byte.class) - return (Byte.class); - if (type == short.class) - return (Short.class); + private static Class wrapPrimitives(Class type) { + if (!type.isPrimitive()) return type; + if (type == int.class) return (Integer.class); + if (type == long.class) return (Long.class); + if (type == double.class) return (Double.class); + if (type == float.class) return (Float.class); + if (type == boolean.class) return (Boolean.class); + if (type == char.class) return (Character.class); + if (type == byte.class) return (Byte.class); + if (type == short.class) return (Short.class); return type; } @@ -344,19 +340,16 @@ static private Class wrapPrimitives(Class type) { * @param paramTypes the expected parameter types from a constructor * @return true if the arguments are compatible, false otherwise */ - static private boolean areArgsCompatible(Object[] args, Class[] paramTypes) { - if (args.length != paramTypes.length) - return false; + private static boolean areArgsCompatible(Object[] args, Class[] paramTypes) { + if (args.length != paramTypes.length) return false; for (int i = 0; i < args.length; i++) { Object arg = args[i]; Class expectedType = paramTypes[i]; if (arg == null) { - if (expectedType.isPrimitive()) - return false; + if (expectedType.isPrimitive()) return false; continue; } - if (!wrapPrimitives(expectedType).isAssignableFrom(arg.getClass())) - return false; + if (!wrapPrimitives(expectedType).isAssignableFrom(arg.getClass())) return false; } return true; } @@ -371,11 +364,10 @@ static private boolean areArgsCompatible(Object[] args, Class[] paramTypes) { * @param args array of arguments to match against constructor parameters * @return the first compatible constructor found, or null if no compatible constructor exists */ - static private Constructor getCompatibleConstructor(Class clazz, Object[] args) { + private static Constructor getCompatibleConstructor(Class clazz, Object[] args) { Constructor[] constructors = clazz.getConstructors(); for (Constructor constructor : constructors) { - if (areArgsCompatible(args, constructor.getParameterTypes())) - return constructor; + if (areArgsCompatible(args, constructor.getParameterTypes())) return constructor; } return null; } @@ -391,11 +383,7 @@ static private Constructor getCompatibleConstructor(Class clazz, Object[] * @param originalArgs array of original constructor arguments * @return array of arguments with element name prepended if needed */ - static private Object[] prepareConstructorArgs( - boolean isNamedType, - String elementName, - Object[] originalArgs - ) { + private static Object[] prepareConstructorArgs(boolean isNamedType, String elementName, Object[] originalArgs) { if (!isNamedType) { return originalArgs; } @@ -420,21 +408,26 @@ static private Object[] prepareConstructorArgs( * @throws InvocationTargetException if constructor invocation results in an exception * @throws InstantiationException if the metadataClass cannot be instantiated */ - static private SEDAMetadata getClassMemberConstructedFromArgs(Class metadataClass, String elementName, Object[] args) throws SEDALibException, IllegalAccessException, InvocationTargetException, InstantiationException { + private static SEDAMetadata getClassMemberConstructedFromArgs( + Class metadataClass, + String elementName, + Object[] args + ) throws SEDALibException, IllegalAccessException, InvocationTargetException, InstantiationException { boolean isNamedType = metadataClass.getName().contains(".namedtype."); SEDAMetadata sm; Object[] constructorArgs = prepareConstructorArgs(isNamedType, elementName, args); - Constructor compatibleCtor - = getCompatibleConstructor(metadataClass, constructorArgs); + Constructor compatibleCtor = getCompatibleConstructor(metadataClass, constructorArgs); if (compatibleCtor == null) { // Try to use a constructor with a variable argument list (Object... args) pattern try { - if (isNamedType) - sm = (SEDAMetadata) metadataClass.getConstructor(String.class, Object[].class).newInstance(elementName, args); - else - sm = (SEDAMetadata) metadataClass.getConstructor(Object[].class).newInstance(new Object[]{args}); + if (isNamedType) sm = (SEDAMetadata) metadataClass + .getConstructor(String.class, Object[].class) + .newInstance(elementName, args); + else sm = (SEDAMetadata) metadataClass + .getConstructor(Object[].class) + .newInstance(new Object[] { args }); } catch (NoSuchMethodException e) { throw new SEDALibException("Pas de constructeur de l'élément [" + elementName + "]", e); } @@ -449,7 +442,6 @@ static private SEDAMetadata getClassMemberConstructedFromArgs(Class metadataC return sm; } - /** * Constructs a new instance of SEDA metadata. *

    @@ -463,17 +455,19 @@ static private SEDAMetadata getClassMemberConstructedFromArgs(Class metadataC */ default SEDAMetadata newSEDAMetadata(String elementName, Object[] args) throws SEDALibException { LinkedHashMap metadataMap = this.getMetadataMap(); - if (metadataMap == null) - throw new SEDALibException("Impossible de construire l'élément [" + elementName + "] en "+ SedaContext.getVersion(), null); + if (metadataMap == null) throw new SEDALibException( + "Impossible de construire l'élément [" + elementName + "] en " + SedaContext.getVersion(), + null + ); ComplexListMetadataKind metadataKind = metadataMap.get(elementName); try { Class metadataClass = (metadataKind != null ? metadataKind.getMetadataClass() : AnyXMLType.class); SEDAMetadata metadata = getClassMemberConstructedFromArgs(metadataClass, elementName, args); - if (metadata == null) - throw new SEDALibException("Impossible de construire l'élément [" + elementName + "]"); + if (metadata == null) throw new SEDALibException( + "Impossible de construire l'élément [" + elementName + "]" + ); return metadata; - } catch (SecurityException | InstantiationException | IllegalAccessException - | IllegalArgumentException e) { + } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new SEDALibException("Impossible de construire l'élément [" + elementName + "]", e); } catch (InvocationTargetException te) { throw new SEDALibException("Impossible de construire l'élément [" + elementName + "]", te.getCause()); @@ -493,8 +487,7 @@ default int indexOfMetadata(String elementName) throws SEDALibException { LinkedHashMap metadataMap = this.getMetadataMap(); int index = 0; for (String key : metadataMap.keySet()) { - if (key.equals(elementName)) - return index; + if (key.equals(elementName)) return index; index++; } return -1; @@ -516,13 +509,19 @@ default int indexOfMetadata(String elementName) throws SEDALibException { */ default void addNewMetadata(String elementName, Object... args) throws SEDALibException { if (args.length > 0) { - try { + try { SEDAMetadata sm = newSEDAMetadata(elementName, args); addMetadata(sm); - } - catch(SEDALibException e) { - throw new SEDALibException("Impossible d'ajouter l'élément [" + elementName + "] au type composé [" - +this.getXmlElementName()+"] en "+ SedaContext.getVersion(), e); + } catch (SEDALibException e) { + throw new SEDALibException( + "Impossible d'ajouter l'élément [" + + elementName + + "] au type composé [" + + this.getXmlElementName() + + "] en " + + SedaContext.getVersion(), + e + ); } } } @@ -532,6 +531,7 @@ default void addNewMetadata(String elementName, Object... args) throws SEDALibEx * into the metadata list. */ class InsertionInfo { + /** * The index position where the new metadata should be inserted */ @@ -564,8 +564,7 @@ class InsertionInfo { * @param isMany Whether this metadata type allows multiple values * @return InsertionInfo with computed insertion position and replacement flag */ - private InsertionInfo computeInsertionInfoForKnownType( - int newIndex, boolean isMany) throws SEDALibException { + private InsertionInfo computeInsertionInfoForKnownType(int newIndex, boolean isMany) throws SEDALibException { List metadataList = getMetadataList(); int index = 0; boolean replaceExisting = false; @@ -596,13 +595,14 @@ private InsertionInfo computeInsertionInfoForKnownType( * @return InsertionInfo with computed insertion position * @throws SEDALibException if schema is not expandable */ - private InsertionInfo computeInsertionInfoForUnknownType( - String xmlName, - boolean notExpandable) throws SEDALibException { + private InsertionInfo computeInsertionInfoForUnknownType(String xmlName, boolean notExpandable) + throws SEDALibException { List metadataList = getMetadataList(); if (notExpandable) { - throw new SEDALibException("Impossible d'étendre le schéma avec des métadonnées non prévues [" + xmlName + "]"); + throw new SEDALibException( + "Impossible d'étendre le schéma avec des métadonnées non prévues [" + xmlName + "]" + ); } int index = 0; boolean seen = false; @@ -626,18 +626,16 @@ private InsertionInfo computeInsertionInfoForUnknownType( * @throws SEDALibException if adding unknown metadata to a non-expandable type or if other constraints are violated */ default void addMetadata(SEDAMetadata metadata) throws SEDALibException { - if (metadata == null) - return; + if (metadata == null) return; List metadataList = getMetadataList(); boolean notExpandable = isNotExpandable(); String xmlName = metadata.getXmlElementName(); int newIndex = indexOfMetadata(xmlName); - InsertionInfo info = (newIndex == -1) - ? computeInsertionInfoForUnknownType(xmlName, notExpandable) - : computeInsertionInfoForKnownType(newIndex, isAMultiValuedMetadata(xmlName)); + ? computeInsertionInfoForUnknownType(xmlName, notExpandable) + : computeInsertionInfoForKnownType(newIndex, isAMultiValuedMetadata(xmlName)); if (info.replaceExisting) { metadataList.set(info.insertionIndex, metadata); @@ -655,8 +653,7 @@ default void addMetadata(SEDAMetadata metadata) throws SEDALibException { default boolean isMetadataLacking(String elementName) { List metadataList = this.getMetadataList(); for (SEDAMetadata sm : metadataList) { - if (sm.getXmlElementName().equals(elementName)) - return false; + if (sm.getXmlElementName().equals(elementName)) return false; } return true; } @@ -669,8 +666,7 @@ default boolean isMetadataLacking(String elementName) { */ default void toSedaXmlMetadataList(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { List metadataList = getMetadataList(); - for (SEDAMetadata sm : metadataList) - sm.toSedaXml(xmlWriter); + for (SEDAMetadata sm : metadataList) sm.toSedaXml(xmlWriter); } /** @@ -691,10 +687,8 @@ default LinkedHashMap toCsvList() throws SEDALibException { count = 0; } else count++; final String addedName; - if (isAMultiValuedMetadata(sm.getXmlElementName())) - addedName = sm.getXmlElementName() + "." + count; - else - addedName = sm.getXmlElementName(); + if (isAMultiValuedMetadata(sm.getXmlElementName())) addedName = sm.getXmlElementName() + "." + count; + else addedName = sm.getXmlElementName(); LinkedHashMap smCsvList = sm.toCsvList(); for (Map.Entry e : smCsvList.entrySet()) { result.put(addedName + (e.getKey().isEmpty() ? "" : "." + e.getKey()), e.getValue()); @@ -720,14 +714,11 @@ default boolean fillFromSedaXmlMetadataList(SEDAXMLEventReader xmlReader) throws while (tmp != null) { ComplexListMetadataKind mi = metadataMap.get(tmp); if (mi == null) { - if (isNotExpandable) - throw new SEDALibException( - "Impossible d'étendre le schéma avec des métadonnées non prévues [" - + tmp + "]"); - else - metadataClass = AnyXMLType.class; - } else - metadataClass = mi.getMetadataClass(); + if (isNotExpandable) throw new SEDALibException( + "Impossible d'étendre le schéma avec des métadonnées non prévues [" + tmp + "]" + ); + else metadataClass = AnyXMLType.class; + } else metadataClass = mi.getMetadataClass(); SEDAMetadata sm = SEDAMetadata.fromSedaXml(xmlReader, metadataClass); this.addMetadata(sm); tmp = xmlReader.peekName(); @@ -751,17 +742,19 @@ default boolean fillFromSedaXmlMetadataList(SEDAXMLEventReader xmlReader) throws * @return resolved metadata class * @throws SEDALibException if element not found in non-expandable schema */ - static private Class resolveMetadataClass(String name, - Map metadataMap, - boolean notExpandable) - throws SEDALibException { + private static Class resolveMetadataClass( + String name, + Map metadataMap, + boolean notExpandable + ) throws SEDALibException { ComplexListMetadataKind kind = metadataMap.get(name); if (kind != null) { return kind.getMetadataClass(); } if (notExpandable) { - throw new SEDALibException("Impossible d'étendre le schéma avec des métadonnées non prévues [" - + name + "]"); + throw new SEDALibException( + "Impossible d'étendre le schéma avec des métadonnées non prévues [" + name + "]" + ); } return AnyXMLType.class; } @@ -776,9 +769,10 @@ default void addSedaXmlFragments(String xmlData) throws SEDALibException { LinkedHashMap metadataMap = this.getMetadataMap(); boolean isNotExpandable = this.isNotExpandable(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { - + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { xmlReader.nextUsefullEvent(); // jump document start String elementName = xmlReader.peekName(); while (elementName != null) { @@ -801,8 +795,7 @@ default void addSedaXmlFragments(String xmlData) throws SEDALibException { default SEDAMetadata getFirstNamedMetadata(String elementName) { List metadataList = this.getMetadataList(); for (SEDAMetadata sm : metadataList) { - if (elementName.equals(sm.getXmlElementName())) - return sm; + if (elementName.equals(sm.getXmlElementName())) return sm; } return null; } @@ -835,14 +828,13 @@ default String getSimpleMetadata(String metadataName) { String langText = null; for (SEDAMetadata sm : metadataList) { if (sm.getXmlElementName().equals(metadataName)) { - if (sm instanceof StringType) - return ((StringType) sm).getValue(); - else if ((sm instanceof TextType) && (((TextType) sm).getLang() == null)) - return ((TextType) sm).getValue(); - else if ((sm instanceof TextType) && (((TextType) sm).getLang().equals("fr"))) - langText = ((TextType) sm).getValue(); - else if ((sm instanceof EnumType)) - return ((EnumType) sm).getValue(); + if (sm instanceof StringType) return ((StringType) sm).getValue(); + else if ((sm instanceof TextType) && (((TextType) sm).getLang() == null)) return ( + (TextType) sm + ).getValue(); + else if ((sm instanceof TextType) && (((TextType) sm).getLang().equals("fr"))) langText = + ((TextType) sm).getValue(); + else if ((sm instanceof EnumType)) return ((EnumType) sm).getValue(); else if (sm instanceof DateTimeType) { return (((DateTimeType) sm).getDateTimeString()); } @@ -861,8 +853,7 @@ else if (sm instanceof DateTimeType) { default boolean isAMultiValuedMetadata(String metadataName) throws SEDALibException { LinkedHashMap metadataMap = getMetadataMap(); ComplexListMetadataKind clmk = metadataMap.get(metadataName); - if (clmk == null) - return true; + if (clmk == null) return true; return clmk.isMany(); } -} \ No newline at end of file +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java index 7fc19821..c068ed88 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataKind.java @@ -41,6 +41,7 @@ * The type Complex list metadata kind. */ public class ComplexListMetadataKind { + /** * The metadata class. */ diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java index 50b9444f..d27875da 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListMetadataMap.java @@ -41,10 +41,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.Arrays; @Retention(RetentionPolicy.RUNTIME) public @interface ComplexListMetadataMap { boolean isExpandable() default false; + SedaVersion[] sedaVersion() default {}; } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java index a86c9e43..eb14a827 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/ComplexListType.java @@ -57,7 +57,8 @@ public abstract class ComplexListType extends NamedTypeMetadata implements Compl /** * The Sub type metadata map map by versions. */ - protected static Map, Map>> subTypeMetadataMapsMap = new HashMap<>(); + protected static Map, Map>> subTypeMetadataMapsMap = + new HashMap<>(); /** * The Sub type expandable map by versions. @@ -107,8 +108,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { toSedaXmlMetadataList(xmlWriter); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException( - "Erreur d'écriture XML dans un élément [" + getXmlElementName() + "]", e); + throw new SEDALibException("Erreur d'écriture XML dans un élément [" + getXmlElementName() + "]", e); } } @@ -132,8 +132,7 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (xmlReader.nextBlockIfNamed(elementName)) { fillFromSedaXmlMetadataList(xmlReader); xmlReader.endBlockNamed(elementName); - } else - return false; + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément [" + elementName + "]", e); } @@ -163,7 +162,8 @@ public LinkedHashMap getMetadataMap() throws SE } @JsonIgnore - public static LinkedHashMap getMetadataMap(Class clazz) throws SEDALibException { + public static LinkedHashMap getMetadataMap(Class clazz) + throws SEDALibException { return (LinkedHashMap) ComplexListInterface.getMetadataMap(clazz); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java index 5789d5aa..6faf76b3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DataObjectOrArchiveUnitReferenceType.java @@ -50,7 +50,7 @@ */ public class DataObjectOrArchiveUnitReferenceType extends ComplexListType { - static final String DATAOBJECTREFERENCE="DataObjectReference"; + static final String DATAOBJECTREFERENCE = "DataObjectReference"; /** * Init metadata map. @@ -83,9 +83,8 @@ public DataObjectOrArchiveUnitReferenceType(String elementName) { * @param dataObjectGroupID the data object group id * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public DataObjectOrArchiveUnitReferenceType(String elementName, String dataObjectGroupID) throws SEDALibException{ + public DataObjectOrArchiveUnitReferenceType(String elementName, String dataObjectGroupID) throws SEDALibException { super(elementName); - addNewMetadata(DATAOBJECTREFERENCE, null,dataObjectGroupID); + addNewMetadata(DATAOBJECTREFERENCE, null, dataObjectGroupID); } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java index 6dc179cb..d7566ff6 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeType.java @@ -81,8 +81,14 @@ public class DateTimeType extends NamedTypeMetadata { * Enumeration of supported temporal format types. */ public enum DateTimeFormatType { - OFFSET_DATE_TIME, DATE_TIME, DATE, - G_YEAR, G_YEAR_MONTH, G_MONTH, G_MONTH_DAY, G_DAY + OFFSET_DATE_TIME, + DATE_TIME, + DATE, + G_YEAR, + G_YEAR_MONTH, + G_MONTH, + G_MONTH_DAY, + G_DAY, } @JsonIgnore @@ -91,22 +97,18 @@ public enum DateTimeFormatType { private DateTimeFormatType formatType; // --- Regex patterns for format detection --- - private static final Pattern OFFSET_DATE_TIME_PATTERN = - Pattern.compile("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,9})?)?([+-]\\d{2}:\\d{2}|Z)$"); - private static final Pattern DATE_TIME_PATTERN = - Pattern.compile("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,9})?)?$"); - private static final Pattern DATE_PATTERN = - Pattern.compile("^\\d{4}-\\d{2}-\\d{2}$"); - private static final Pattern G_YEAR_PATTERN = - Pattern.compile("^\\d{4}$"); - private static final Pattern G_YEAR_MONTH_PATTERN = - Pattern.compile("^\\d{4}-\\d{2}$"); - private static final Pattern G_MONTH_PATTERN = - Pattern.compile("^--\\d{2}$"); - private static final Pattern G_MONTH_DAY_PATTERN = - Pattern.compile("^--\\d{2}-\\d{2}$"); - private static final Pattern G_DAY_PATTERN = - Pattern.compile("^---\\d{2}$"); + private static final Pattern OFFSET_DATE_TIME_PATTERN = Pattern.compile( + "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,9})?)?([+-]\\d{2}:\\d{2}|Z)$" + ); + private static final Pattern DATE_TIME_PATTERN = Pattern.compile( + "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,9})?)?$" + ); + private static final Pattern DATE_PATTERN = Pattern.compile("^\\d{4}-\\d{2}-\\d{2}$"); + private static final Pattern G_YEAR_PATTERN = Pattern.compile("^\\d{4}$"); + private static final Pattern G_YEAR_MONTH_PATTERN = Pattern.compile("^\\d{4}-\\d{2}$"); + private static final Pattern G_MONTH_PATTERN = Pattern.compile("^--\\d{2}$"); + private static final Pattern G_MONTH_DAY_PATTERN = Pattern.compile("^--\\d{2}-\\d{2}$"); + private static final Pattern G_DAY_PATTERN = Pattern.compile("^---\\d{2}$"); // ===================================================================================== // Constructors @@ -261,15 +263,24 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ private DateTimeFormatter getFormatter() throws SEDALibException { switch (formatType) { - case OFFSET_DATE_TIME: return DateTimeFormatter.ISO_OFFSET_DATE_TIME; - case DATE_TIME: return DateTimeFormatter.ISO_LOCAL_DATE_TIME; - case DATE: return DateTimeFormatter.ISO_LOCAL_DATE; - case G_YEAR: return DateTimeFormatter.ofPattern("uuuu"); - case G_YEAR_MONTH: return DateTimeFormatter.ofPattern("uuuu-MM"); - case G_MONTH: return DateTimeFormatter.ofPattern("'--'MM"); - case G_MONTH_DAY: return DateTimeFormatter.ofPattern("'--'MM-dd"); - case G_DAY: return DateTimeFormatter.ofPattern("'---'dd"); - default: throw new SEDALibException("Date type not handled: " + formatType); + case OFFSET_DATE_TIME: + return DateTimeFormatter.ISO_OFFSET_DATE_TIME; + case DATE_TIME: + return DateTimeFormatter.ISO_LOCAL_DATE_TIME; + case DATE: + return DateTimeFormatter.ISO_LOCAL_DATE; + case G_YEAR: + return DateTimeFormatter.ofPattern("uuuu"); + case G_YEAR_MONTH: + return DateTimeFormatter.ofPattern("uuuu-MM"); + case G_MONTH: + return DateTimeFormatter.ofPattern("'--'MM"); + case G_MONTH_DAY: + return DateTimeFormatter.ofPattern("'--'MM-dd"); + case G_DAY: + return DateTimeFormatter.ofPattern("'---'dd"); + default: + throw new SEDALibException("Date type not handled: " + formatType); } } @@ -303,8 +314,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { */ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibException { try { - if (!xmlReader.peekBlockIfNamed(elementName)) - return false; + if (!xmlReader.peekBlockIfNamed(elementName)) return false; XMLEvent event = xmlReader.nextUsefullEvent(); elementName = event.asStartElement().getName().getLocalPart(); event = xmlReader.nextUsefullEvent(); @@ -315,8 +325,9 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep temporalValue = null; formatType = null; } - if (!event.isEndElement() || !elementName.equals(event.asEndElement().getName().getLocalPart())) - throw new SEDALibException("Element " + elementName + " not properly terminated"); + if ( + !event.isEndElement() || !elementName.equals(event.asEndElement().getName().getLocalPart()) + ) throw new SEDALibException("Element " + elementName + " not properly terminated"); return true; } catch (Exception e) { throw new SEDALibException("XML reading error in DateTimeType", e); @@ -349,8 +360,7 @@ public String getFormatType() { /** @return the date/time as a formatted string */ @JsonGetter("dateTimeString") public String getDateTimeString() { - if (temporalValue == null) - return ""; + if (temporalValue == null) return ""; try { return getFormatter().format(temporalValue); } catch (SEDALibException e) { @@ -380,27 +390,24 @@ public void setDateTimeString(String dateTimeString) { */ @JsonIgnore public String getUtcDateTimeString() { - if (temporalValue == null) - return ""; - if (formatType == DateTimeFormatType.G_YEAR - || formatType == DateTimeFormatType.G_YEAR_MONTH - || formatType == DateTimeFormatType.G_MONTH - || formatType == DateTimeFormatType.G_MONTH_DAY - || formatType == DateTimeFormatType.G_DAY) - return ""; + if (temporalValue == null) return ""; + if ( + formatType == DateTimeFormatType.G_YEAR || + formatType == DateTimeFormatType.G_YEAR_MONTH || + formatType == DateTimeFormatType.G_MONTH || + formatType == DateTimeFormatType.G_MONTH_DAY || + formatType == DateTimeFormatType.G_DAY + ) return ""; try { OffsetDateTime utcDateTime; if (temporalValue instanceof OffsetDateTime) { utcDateTime = ((OffsetDateTime) temporalValue).withOffsetSameInstant(ZoneOffset.UTC); } else if (temporalValue instanceof LocalDateTime) { - utcDateTime = ((LocalDateTime) temporalValue) - .atZone(ZoneId.systemDefault()) + utcDateTime = ((LocalDateTime) temporalValue).atZone(ZoneId.systemDefault()) .withZoneSameInstant(ZoneOffset.UTC) .toOffsetDateTime(); } else if (temporalValue instanceof LocalDate) { - utcDateTime = ((LocalDate) temporalValue) - .atStartOfDay(ZoneOffset.UTC) - .toOffsetDateTime(); + utcDateTime = ((LocalDate) temporalValue).atStartOfDay(ZoneOffset.UTC).toOffsetDateTime(); } else { return ""; } @@ -417,20 +424,18 @@ public String getUtcDateTimeString() { */ @JsonIgnore public LocalDateTime toLocalDateTime() { - if (temporalValue == null) - return null; - if (formatType == DateTimeFormatType.G_YEAR - || formatType == DateTimeFormatType.G_YEAR_MONTH - || formatType == DateTimeFormatType.G_MONTH - || formatType == DateTimeFormatType.G_MONTH_DAY - || formatType == DateTimeFormatType.G_DAY) - return null; + if (temporalValue == null) return null; + if ( + formatType == DateTimeFormatType.G_YEAR || + formatType == DateTimeFormatType.G_YEAR_MONTH || + formatType == DateTimeFormatType.G_MONTH || + formatType == DateTimeFormatType.G_MONTH_DAY || + formatType == DateTimeFormatType.G_DAY + ) return null; try { switch (formatType) { case OFFSET_DATE_TIME: - return ((OffsetDateTime) temporalValue) - .atZoneSameInstant(ZoneId.systemDefault()) - .toLocalDateTime(); + return ((OffsetDateTime) temporalValue).atZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); case DATE_TIME: return (LocalDateTime) temporalValue; case DATE: diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java index fd4758c5..8c595f63 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateType.java @@ -64,7 +64,7 @@ public class DateType extends NamedTypeMetadata { * Instantiates a new string. */ public DateType() { - this(null, (LocalDate)null); + this(null, (LocalDate) null); } /** @@ -73,7 +73,7 @@ public DateType() { * @param elementName the XML element name */ public DateType(String elementName) { - this(elementName, (LocalDate)null); + this(elementName, (LocalDate) null); } /** @@ -98,9 +98,10 @@ public DateType(String elementName, String dateString) throws SEDALibException { super(elementName); try { this.value = SEDAXMLEventReader.getDateFromString(dateString); - } - catch( DateTimeParseException e) { - throw new SEDALibException("Problème de formatage de date à la création d'un élément [" + elementName + "]"); + } catch (DateTimeParseException e) { + throw new SEDALibException( + "Problème de formatage de date à la création d'un élément [" + elementName + "]" + ); } } @@ -114,12 +115,13 @@ public DateType(String elementName, String dateString) throws SEDALibException { @Override public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { - if (value == null) - xmlWriter.writeElementValue(elementName, null); - else - xmlWriter.writeElementValue(elementName, SEDAXMLStreamWriter.getStringFromDate(value)); + if (value == null) xmlWriter.writeElementValue(elementName, null); + else xmlWriter.writeElementValue(elementName, SEDAXMLStreamWriter.getStringFromDate(value)); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type DateTimeType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type DateTimeType [" + getXmlElementName() + "]", + e + ); } } @@ -131,8 +133,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - if (value != null) - result.put("",SEDAXMLStreamWriter.getStringFromDate(value)); + if (value != null) result.put("", SEDAXMLStreamWriter.getStringFromDate(value)); return result; } @@ -158,10 +159,10 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep throw new SEDALibException("La date est mal formatée", e); } event = xmlReader.nextUsefullEvent(); - } else - value = null; - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else value = null; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type DateTimeType", e); diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java index c2f7f8af..fad501d2 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DigestType.java @@ -113,12 +113,14 @@ public DigestType(String elementName, String value, String algorithm) { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeStartElement(elementName); - if (algorithm != null) - xmlWriter.writeAttribute("algorithm", algorithm); + if (algorithm != null) xmlWriter.writeAttribute("algorithm", algorithm); xmlWriter.writeCharactersIfNotEmpty(value); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type DigestType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type DigestType [" + getXmlElementName() + "]", + e + ); } } @@ -132,8 +134,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); if (value != null) { result.put("", value); - if (algorithm != null) - result.put("attr", "algorithm=\""+algorithm+"\""); + if (algorithm != null) result.put("attr", "algorithm=\"" + algorithm + "\""); } return result; } @@ -154,12 +155,11 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (event.isCharacters()) { value = event.asCharacters().getData(); event = xmlReader.nextUsefullEvent(); - } else - value = ""; - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = ""; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type DigestType", e); } @@ -205,6 +205,4 @@ public void setValue(String value) { public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } - - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java index 31d42bc6..36863ea1 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumType.java @@ -44,7 +44,6 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; -import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -69,7 +68,7 @@ public class EnumType extends NamedTypeMetadata { * Instantiates a new enum type. */ public EnumType() throws SEDALibException { - this(null,null); + this(null, null); } /** @@ -88,20 +87,15 @@ public EnumType(String elementName) throws SEDALibException { * @param value the value * @throws SEDALibException the seda lib exception */ - public EnumType(String elementName,String value) throws SEDALibException { + public EnumType(String elementName, String value) throws SEDALibException { super(elementName); - List enumValues= EnumTypeConstants.enumListMap.get(elementName); - if (enumValues==null) - throw new SEDALibException("Type Enuméré ["+elementName+"] inconnu"); - if (value==null) - this.value= ""; - else if (value.isEmpty() || enumValues.contains(value)) - this.value = value; - else - throw new SEDALibException("Valeur interdite ["+value+"] dans un élément [" + elementName + "]"); + List enumValues = EnumTypeConstants.enumListMap.get(elementName); + if (enumValues == null) throw new SEDALibException("Type Enuméré [" + elementName + "] inconnu"); + if (value == null) this.value = ""; + else if (value.isEmpty() || enumValues.contains(value)) this.value = value; + else throw new SEDALibException("Valeur interdite [" + value + "] dans un élément [" + elementName + "]"); } - /* * (non-Javadoc) * @@ -114,7 +108,10 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeElementValue(elementName, value); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type KeywordType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type KeywordType [" + getXmlElementName() + "]", + e + ); } } @@ -126,7 +123,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - result.put("",value); + result.put("", value); return result; } @@ -144,19 +141,17 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep XMLEvent event = xmlReader.nextUsefullEvent(); if (event.isCharacters()) { value = event.asCharacters().getData(); - List enumValues= EnumTypeConstants.enumListMap.get(elementName); - if (enumValues==null) - throw new SEDALibException("Type Enuméré ["+elementName+"] inconnu"); - if (!enumValues.contains(value)) - throw new SEDALibException("Valeur interdite dans un élément [" + elementName + "]"); + List enumValues = EnumTypeConstants.enumListMap.get(elementName); + if (enumValues == null) throw new SEDALibException("Type Enuméré [" + elementName + "] inconnu"); + if (!enumValues.contains(value)) throw new SEDALibException( + "Valeur interdite dans un élément [" + elementName + "]" + ); event = xmlReader.nextUsefullEvent(); - } else - value = ""; - if ((!event.isEndElement()) - || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = ""; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type KeywordType", e); } @@ -183,14 +178,10 @@ public String getValue() { * @throws SEDALibException the seda lib exception */ public void setValue(String value) throws SEDALibException { - List enumValues= EnumTypeConstants.enumListMap.get(elementName); - if (enumValues==null) - throw new SEDALibException("Type Enuméré ["+elementName+"] inconnu"); - if (value==null) - this.value= ""; - else if (value.isEmpty() || enumValues.contains(value)) - this.value = value; - else - throw new SEDALibException("Valeur interdite dans un élément [" + elementName + "]"); + List enumValues = EnumTypeConstants.enumListMap.get(elementName); + if (enumValues == null) throw new SEDALibException("Type Enuméré [" + elementName + "] inconnu"); + if (value == null) this.value = ""; + else if (value.isEmpty() || enumValues.contains(value)) this.value = value; + else throw new SEDALibException("Valeur interdite dans un élément [" + elementName + "]"); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java index e6bd06fb..fd93cbb7 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/EnumTypeConstants.java @@ -43,6 +43,7 @@ import java.util.Map; public class EnumTypeConstants { + /** * The EnumType different enum list by element name map. */ @@ -50,12 +51,38 @@ public class EnumTypeConstants { static { enumListMap = new HashMap<>(); - enumListMap.put("KeywordType", Arrays.asList("corpname", "famname", "geogname", "name", - "occupation", "persname", "subject", "genreform", "function")); + enumListMap.put( + "KeywordType", + Arrays.asList( + "corpname", + "famname", + "geogname", + "name", + "occupation", + "persname", + "subject", + "genreform", + "function" + ) + ); enumListMap.put("SigningRole", Arrays.asList("SignedDocument", "Timestamp", "Signature", "AdditionalProof")); enumListMap.put("DetachedSigningRole", Arrays.asList("Timestamp", "Signature", "AdditionalProof")); - enumListMap.put("DescriptionLevel", Arrays.asList("Fonds", "Subfonds", "Class", "Collection", - "Series", "Subseries", "RecordGrp", "SubGrp", "File", "Item", "OtherLevel")); + enumListMap.put( + "DescriptionLevel", + Arrays.asList( + "Fonds", + "Subfonds", + "Class", + "Collection", + "Series", + "Subseries", + "RecordGrp", + "SubGrp", + "File", + "Item", + "OtherLevel" + ) + ); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java index e927fa24..2b43d998 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/InnerIdentifierType.java @@ -84,8 +84,8 @@ public InnerIdentifierType(String elementName) { * @param elementName the XML element name * @param value the value */ - public InnerIdentifierType(String elementName, String value) throws SEDALibException{ + public InnerIdentifierType(String elementName, String value) throws SEDALibException { super(elementName); - if ((value!=null) && !value.isEmpty()) addNewMetadata("Identifier",value); + if ((value != null) && !value.isEmpty()) addNewMetadata("Identifier", value); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java index 0732ed09..7b7ab037 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/IntegerType.java @@ -62,7 +62,7 @@ public class IntegerType extends NamedTypeMetadata { * Instantiates a new integer. */ public IntegerType() { - this(null, (Long)null); + this(null, (Long) null); } /** @@ -71,7 +71,7 @@ public IntegerType() { * @param elementName the XML element name */ public IntegerType(String elementName) { - this(elementName, (Long)null); + this(elementName, (Long) null); } /** @@ -93,7 +93,7 @@ public IntegerType(String elementName, Long value) { */ public IntegerType(String elementName, int value) { super(elementName); - this.value = ((long)value); + this.value = ((long) value); } /** @@ -107,8 +107,7 @@ public IntegerType(String elementName, Object[] args) throws SEDALibException { super(elementName); if ((args.length == 1) && (args[0] instanceof Integer)) { this.value = (Long) args[0]; - } else - throw new SEDALibException("Mauvais constructeur de l'élément [" + elementName + "]"); + } else throw new SEDALibException("Mauvais constructeur de l'élément [" + elementName + "]"); } /* @@ -121,9 +120,12 @@ public IntegerType(String elementName, Object[] args) throws SEDALibException { @Override public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { - xmlWriter.writeElementValue(elementName, (value==null?"":Long.toString(value))); + xmlWriter.writeElementValue(elementName, (value == null ? "" : Long.toString(value))); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type IntegerType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type IntegerType [" + getXmlElementName() + "]", + e + ); } } @@ -135,7 +137,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - result.put("", (value==null?"":Long.toString(value))); + result.put("", (value == null ? "" : Long.toString(value))); return result; } @@ -153,18 +155,16 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep XMLEvent event = xmlReader.nextUsefullEvent(); if (event.isCharacters()) { String tmp = event.asCharacters().getData(); - if ((tmp == null) || tmp.isEmpty()) - value = null; - else - value = Long.parseLong(tmp); + if ((tmp == null) || tmp.isEmpty()) value = null; + else value = Long.parseLong(tmp); event = xmlReader.nextUsefullEvent(); - } else - throw new SEDALibException("Erreur de lecture XML dans un élément de type IntegerType qui est vide"); - if ((!event.isEndElement()) - || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else throw new SEDALibException( + "Erreur de lecture XML dans un élément de type IntegerType qui est vide" + ); + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type IntegerType", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java index 605b6e79..e7832eab 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinearDimensionType.java @@ -58,8 +58,19 @@ public class LinearDimensionType extends NamedTypeMetadata { /** * Enum restricted values. */ - public static final List enumValues = Arrays.asList("micrometre", "4H", - "millimetre", "MMT", "centimetre", "CMT", "metre", "inch", "INH", "foot", "FOT"); + public static final List enumValues = Arrays.asList( + "micrometre", + "4H", + "millimetre", + "MMT", + "centimetre", + "CMT", + "metre", + "inch", + "INH", + "foot", + "FOT" + ); /** * The value. @@ -112,8 +123,9 @@ public LinearDimensionType(String elementName, Double value) throws SEDALibExcep public LinearDimensionType(String elementName, Double value, String unit) throws SEDALibException { super(elementName); this.value = value; - if ((unit != null) && !enumValues.contains(unit)) - throw new SEDALibException("[" + unit + "] n'est pas une unité de mesure linéraire"); + if ((unit != null) && !enumValues.contains(unit)) throw new SEDALibException( + "[" + unit + "] n'est pas une unité de mesure linéraire" + ); this.unit = unit; } @@ -128,13 +140,14 @@ public LinearDimensionType(String elementName, Double value, String unit) throws public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeStartElement(elementName); - if (unit != null) - xmlWriter.writeAttribute("unit", unit); - if (value != null) - xmlWriter.writeCharactersIfNotEmpty(Double.toString(value)); + if (unit != null) xmlWriter.writeAttribute("unit", unit); + if (value != null) xmlWriter.writeCharactersIfNotEmpty(Double.toString(value)); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type LinearDimensionType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type LinearDimensionType [" + getXmlElementName() + "]", + e + ); } } @@ -148,8 +161,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); if (value != null) { result.put("", value.toString()); - if (unit != null) - result.put("attr", "unit=\"" + unit + "\""); + if (unit != null) result.put("attr", "unit=\"" + unit + "\""); } return result; } @@ -170,12 +182,11 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (event.isCharacters()) { value = Double.parseDouble(event.asCharacters().getData()); event = xmlReader.nextUsefullEvent(); - } else - value = null; - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = null; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type LinearDimensionType", e); } @@ -199,7 +210,7 @@ public String getUnit() { * @return the value */ @Override - @JsonIgnore(false) + @JsonIgnore(false) public Double getValue() { return value; } @@ -220,8 +231,9 @@ public void setValue(Double value) { * @throws SEDALibException if unknown measure unit */ public void setUnit(String unit) throws SEDALibException { - if ((unit != null) && !enumValues.contains(unit)) - throw new SEDALibException("[" + unit + "] n'est pas une unité de mesure linéraire"); + if ((unit != null) && !enumValues.contains(unit)) throw new SEDALibException( + "[" + unit + "] n'est pas une unité de mesure linéraire" + ); this.unit = unit; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java index 5373e0c5..218f4589 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/LinkingAgentIdentifier.java @@ -44,6 +44,7 @@ import java.util.Map; public class LinkingAgentIdentifier extends ComplexListType { + /** * Init metadata map. */ @@ -75,16 +76,21 @@ public LinkingAgentIdentifier(String elementName) { * @param linkingAgentRole the linking agent role * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public LinkingAgentIdentifier(String elementName, - String linkingAgentIdentifierType, - String linkingAgentIdentifierValue, - String linkingAgentRole) throws SEDALibException{ + public LinkingAgentIdentifier( + String elementName, + String linkingAgentIdentifierType, + String linkingAgentIdentifierValue, + String linkingAgentRole + ) throws SEDALibException { super(elementName); - if (linkingAgentIdentifierType!=null) - addNewMetadata("LinkingAgentIdentifierType", linkingAgentIdentifierType); - if (linkingAgentIdentifierValue!=null) - addNewMetadata("LinkingAgentIdentifierValue", linkingAgentIdentifierValue); - if (linkingAgentRole!=null) - addNewMetadata("LinkingAgentRole", linkingAgentRole); + if (linkingAgentIdentifierType != null) addNewMetadata( + "LinkingAgentIdentifierType", + linkingAgentIdentifierType + ); + if (linkingAgentIdentifierValue != null) addNewMetadata( + "LinkingAgentIdentifierValue", + linkingAgentIdentifierValue + ); + if (linkingAgentRole != null) addNewMetadata("LinkingAgentRole", linkingAgentRole); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java index 1a6e3d07..6e969c53 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/PlaceType.java @@ -49,7 +49,7 @@ */ public class PlaceType extends ComplexListType { - static final String GEOGNAME="Geogname"; + static final String GEOGNAME = "Geogname"; /** * Init metadata map. @@ -83,8 +83,8 @@ public PlaceType(String elementName) { * @param geogname the geogname * @throws SEDALibException if sub elements construction is not possible (not supposed to occur) */ - public PlaceType(String elementName, String geogname) throws SEDALibException{ + public PlaceType(String elementName, String geogname) throws SEDALibException { super(elementName); - addNewMetadata(GEOGNAME, geogname); + addNewMetadata(GEOGNAME, geogname); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java index db70a973..3772f881 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleMetadataKind.java @@ -39,7 +39,6 @@ public class RuleMetadataKind extends ComplexListMetadataKind { - /** * Instantiates a new metadata item. * diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java index 8e81ae3c..05b26e43 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/RuleType.java @@ -80,7 +80,7 @@ public RuleType(String elementName) { */ public RuleType(String elementName, String rule, LocalDate startDate) throws SEDALibException { super(elementName); - addNewMetadata(RULE_TAG,rule,startDate); + addNewMetadata(RULE_TAG, rule, startDate); } /** @@ -90,7 +90,7 @@ public RuleType(String elementName, String rule, LocalDate startDate) throws SED * @throws SEDALibException the seda lib exception */ public void addRule(String rule) throws SEDALibException { - addNewMetadata(RULE_TAG,rule,null); + addNewMetadata(RULE_TAG, rule, null); } /** @@ -101,7 +101,7 @@ public void addRule(String rule) throws SEDALibException { * @throws SEDALibException the seda lib exception */ public void addRule(String rule, LocalDate startDate) throws SEDALibException { - addNewMetadata(RULE_TAG,rule,startDate); + addNewMetadata(RULE_TAG, rule, startDate); } /** @@ -111,7 +111,7 @@ public void addRule(String rule, LocalDate startDate) throws SEDALibException { * @throws SEDALibException the seda lib exception */ public void setPreventInheritance(boolean preventInheritance) throws SEDALibException { - addNewMetadata(PREVENTINHERITANCE_TAG,preventInheritance); + addNewMetadata(PREVENTINHERITANCE_TAG, preventInheritance); } /** @@ -121,7 +121,7 @@ public void setPreventInheritance(boolean preventInheritance) throws SEDALibExce * @throws SEDALibException the seda lib exception */ public void addRefNonRuleId(String rule) throws SEDALibException { - addNewMetadata(REFNONRULEID_TAG,rule); + addNewMetadata(REFNONRULEID_TAG, rule); } /** @@ -132,12 +132,13 @@ public void addRefNonRuleId(String rule) throws SEDALibException { */ public void setFinalAction(String finalAction) throws SEDALibException { List finalValues = getFinalActionList(); - if (finalValues == null) - throw new SEDALibException("Le type de règle [" + elementName + "] n'a pas de FinalAction"); - if (!finalValues.contains(finalAction)) - throw new SEDALibException( - "Le type de règle [" + elementName + "] n'accepte pas la FinalAction [" + finalAction + "]"); - addNewMetadata(FINALACTION_TAG,finalAction); + if (finalValues == null) throw new SEDALibException( + "Le type de règle [" + elementName + "] n'a pas de FinalAction" + ); + if (!finalValues.contains(finalAction)) throw new SEDALibException( + "Le type de règle [" + elementName + "] n'accepte pas la FinalAction [" + finalAction + "]" + ); + addNewMetadata(FINALACTION_TAG, finalAction); } /* @@ -165,13 +166,10 @@ public LinkedHashMap toCsvList() throws SEDALibException { if (!sm.getXmlElementName().equals(previousXMLElementName)) { previousXMLElementName = sm.getXmlElementName(); count = 0; - } else - count++; + } else count++; final String addedName; - if (isAMultiValuedMetadata(sm.getXmlElementName())) - addedName = sm.getXmlElementName() + "." + count; - else - addedName = sm.getXmlElementName(); + if (isAMultiValuedMetadata(sm.getXmlElementName())) addedName = sm.getXmlElementName() + "." + count; + else addedName = sm.getXmlElementName(); smCsvList = sm.toCsvList(); smCsvList.forEach((key, value) -> result.put(addedName + (key.isEmpty() ? "" : "." + key), value)); } @@ -184,8 +182,9 @@ public LinkedHashMap toCsvList() throws SEDALibException { * * @return the final action list */ - public List getFinalActionList(){return null;} - + public List getFinalActionList() { + return null; + } @Override public void addMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { @@ -195,17 +194,15 @@ public void addMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { i = 0; setFlag = false; if (addOrderIndex == -1) { - if (isNotExpandable()) - throw new SEDALibException( - "Impossible d'étendre le schéma avec des métadonnées non prévues [" - + elementName + "]"); + if (isNotExpandable()) throw new SEDALibException( + "Impossible d'étendre le schéma avec des métadonnées non prévues [" + elementName + "]" + ); manyFlag = true; boolean noBeforeEqual = true; for (SEDAMetadata sm : metadataList) { - if ((sm.getXmlElementName().equals(sedaMetadata.getXmlElementName())) && noBeforeEqual) - noBeforeEqual = false; - if (!(sm.getXmlElementName().equals(sedaMetadata.getXmlElementName())) && !noBeforeEqual) - break; + if ((sm.getXmlElementName().equals(sedaMetadata.getXmlElementName())) && noBeforeEqual) noBeforeEqual = + false; + if (!(sm.getXmlElementName().equals(sedaMetadata.getXmlElementName())) && !noBeforeEqual) break; i++; } } else { @@ -221,19 +218,15 @@ public void addMetadata(SEDAMetadata sedaMetadata) throws SEDALibException { setFlag = true; break; } - if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) - break; + if ((curOrderIndex == -1) || (curOrderIndex > addOrderIndex)) break; i++; } i += lastRuleIndex; } - if (manyFlag) - metadataList.add(i, sedaMetadata); + if (manyFlag) metadataList.add(i, sedaMetadata); else { - if (setFlag) - metadataList.set(i, sedaMetadata); - else - metadataList.add(i, sedaMetadata); + if (setFlag) metadataList.set(i, sedaMetadata); + else metadataList.add(i, sedaMetadata); } } @@ -248,13 +241,16 @@ private int findLastRuleIndex() { } public List getRuleMetadataKindList() throws SEDALibException { - return this.getMetadataMap().entrySet().stream().filter(e -> e.getValue() instanceof RuleMetadataKind) - .map(Entry::getKey).collect(Collectors.toList()); + return this.getMetadataMap() + .entrySet() + .stream() + .filter(e -> e.getValue() instanceof RuleMetadataKind) + .map(Entry::getKey) + .collect(Collectors.toList()); } @Override - public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) - throws SEDALibException { + public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibException { Class metadataClass; try { if (xmlReader.nextBlockIfNamed(elementName)) { @@ -262,21 +258,17 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) while (tmp != null) { ComplexListMetadataKind mi = getMetadataMap().get(tmp); if (mi == null) { - if (isNotExpandable()) - throw new SEDALibException( - "Impossible d'étendre le schéma avec des métadonnées non prévues [" - + tmp + "]"); - else - metadataClass = AnyXMLType.class; - } else - metadataClass = mi.getMetadataClass(); + if (isNotExpandable()) throw new SEDALibException( + "Impossible d'étendre le schéma avec des métadonnées non prévues [" + tmp + "]" + ); + else metadataClass = AnyXMLType.class; + } else metadataClass = mi.getMetadataClass(); SEDAMetadata sm = SEDAMetadata.fromSedaXml(xmlReader, metadataClass); addMetadata(sm); tmp = xmlReader.peekName(); } xmlReader.endBlockNamed(elementName); - } else - return false; + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément [" + elementName + "]", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java index 7fb346a8..8b1a0df3 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/SIPInternalIDType.java @@ -95,7 +95,10 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeElementValue(elementName, value); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type SIPInternalIDType ["+getXmlElementName()+"]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type SIPInternalIDType [" + getXmlElementName() + "]", + e + ); } } @@ -107,7 +110,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - result.put("",value); + result.put("", value); return result; } @@ -126,13 +129,11 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (event.isCharacters()) { value = event.asCharacters().getData(); event = xmlReader.nextUsefullEvent(); - } else - value = ""; - if ((!event.isEndElement()) - || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = ""; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type SIPInternalIDType", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java index a72a4ab2..92a62b5c 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/StringType.java @@ -95,7 +95,10 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeElementValue(elementName, value); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type StringType ["+getXmlElementName()+"]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type StringType [" + getXmlElementName() + "]", + e + ); } } @@ -107,7 +110,7 @@ public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { */ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); - result.put("",value); + result.put("", value); return result; } @@ -126,13 +129,11 @@ public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibExcep if (event.isCharacters()) { value = event.asCharacters().getData(); event = xmlReader.nextUsefullEvent(); - } else - value = ""; - if ((!event.isEndElement()) - || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = ""; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type StringType", e); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java index 709dfd21..0934b9ee 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/TextType.java @@ -114,12 +114,14 @@ public TextType(String elementName, String value, String lang) { public void toSedaXml(SEDAXMLStreamWriter xmlWriter) throws SEDALibException { try { xmlWriter.writeStartElement(elementName); - if (lang != null) - xmlWriter.writeAttribute("xml:lang", lang); + if (lang != null) xmlWriter.writeAttribute("xml:lang", lang); xmlWriter.writeCharactersIfNotEmpty(value); xmlWriter.writeEndElement(); } catch (XMLStreamException e) { - throw new SEDALibException("Erreur d'écriture XML dans un élément de type TextType [" + getXmlElementName() + "]", e); + throw new SEDALibException( + "Erreur d'écriture XML dans un élément de type TextType [" + getXmlElementName() + "]", + e + ); } } @@ -133,8 +135,7 @@ public LinkedHashMap toCsvList() throws SEDALibException { LinkedHashMap result = new LinkedHashMap<>(); if (value != null) { result.put("", value); - if (lang != null) - result.put("attr", "xml:lang=\""+lang+"\""); + if (lang != null) result.put("attr", "xml:lang=\"" + lang + "\""); } return result; } @@ -149,18 +150,17 @@ public LinkedHashMap toCsvList() throws SEDALibException { public boolean fillFromSedaXml(SEDAXMLEventReader xmlReader) throws SEDALibException { try { if (xmlReader.peekBlockIfNamed(elementName)) { - lang = xmlReader.peekAttribute(XMLConstants.XML_NS_URI,"lang"); + lang = xmlReader.peekAttribute(XMLConstants.XML_NS_URI, "lang"); xmlReader.nextUsefullEvent(); XMLEvent event = xmlReader.nextUsefullEvent(); if (event.isCharacters()) { value = event.asCharacters().getData(); event = xmlReader.nextUsefullEvent(); - } else - value = ""; - if ((!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart()))) - throw new SEDALibException("Elément " + elementName + " mal terminé"); - } else - return false; + } else value = ""; + if ( + (!event.isEndElement()) || (!elementName.equals(event.asEndElement().getName().getLocalPart())) + ) throw new SEDALibException("Elément " + elementName + " mal terminé"); + } else return false; } catch (XMLStreamException | IllegalArgumentException | SEDALibException e) { throw new SEDALibException("Erreur de lecture XML dans un élément de type TextType", e); } @@ -206,6 +206,4 @@ public void setValue(String value) { public void setLang(String lang) { this.lang = lang; } - - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java index 6c139f69..0fa31a1f 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/package-info.java @@ -39,4 +39,4 @@ * Package for SEDA generic metadata types, which can have different XML names, with serialization to and * deserilization from XML */ -package fr.gouv.vitam.tools.sedalib.metadata.namedtype; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.metadata.namedtype; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java index 9653cf6a..47c173fa 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/metadata/package-info.java @@ -41,4 +41,4 @@ * Warning: It's possible to choose the SEDA2.x version used but this library is not compliant for parallel use with objects in different versions. * */ -package fr.gouv.vitam.tools.sedalib.metadata; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.metadata; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java index ab2516a3..b8f03da9 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/Compactor.java @@ -114,6 +114,7 @@ public class Compactor { * The compacted files management class and list var. */ static class CompactedFile { + String compactedFilename; Path onDiskPath; @@ -246,8 +247,10 @@ public void setCompactedDocumentPackLimit(int packDocumentsMaxMetadataSize, int * @param documentObjectVersionFilter the document object version filter * @param subDocumentObjectVersionFilter the sub document object version filter */ - public void setObjectVersionFilters(List documentObjectVersionFilter, - List subDocumentObjectVersionFilter) { + public void setObjectVersionFilters( + List documentObjectVersionFilter, + List subDocumentObjectVersionFilter + ) { this.documentObjectVersionFilter = documentObjectVersionFilter; this.subDocumentObjectVersionFilter = subDocumentObjectVersionFilter; } @@ -258,8 +261,10 @@ public void setObjectVersionFilters(List documentObjectVersionFilter, * @param documentContentMetadataFilter the document content metadata filter * @param subDocumentContentMetadataFilter the sub document content metadata filter */ - public void setMetadataFilters(Map documentContentMetadataFilter, - Map subDocumentContentMetadataFilter) { + public void setMetadataFilters( + Map documentContentMetadataFilter, + Map subDocumentContentMetadataFilter + ) { this.documentContentMetadataFilter = documentContentMetadataFilter; this.subDocumentContentMetadataFilter = subDocumentContentMetadataFilter; } @@ -282,10 +287,8 @@ public void setDeflatedFlag(boolean deflatedFlag) { this.deflatedFlag = deflatedFlag; } - private static String getExtension(String fileName) { - if (fileName == null) - return ""; + if (fileName == null) return ""; int i = fileName.lastIndexOf('.'); return i < 0 ? "" : fileName.substring(i + 1); } @@ -293,27 +296,30 @@ private static String getExtension(String fileName) { private static String getExtendedCompactedFileName(String radical, Path onDiskPath) { String extension; extension = getExtension(onDiskPath.getFileName().toString()); - if (!extension.isEmpty()) - return radical + "." + extension; + if (!extension.isEmpty()) return radical + "." + extension; else return radical; } private SEDAMetadata truncateTextType(SEDAMetadata sm, int limit) throws SEDALibException { - if ((sm instanceof TextType) && - (((TextType) sm).getValue().length() > limit)) { - sm = new TextType(sm.getXmlElementName(), - ((TextType) sm).getValue().substring(0, limit), ((TextType) sm).getLang()); + if ((sm instanceof TextType) && (((TextType) sm).getValue().length() > limit)) { + sm = new TextType( + sm.getXmlElementName(), + ((TextType) sm).getValue().substring(0, limit), + ((TextType) sm).getLang() + ); truncatedMetadataCounted++; } if (sm instanceof StringType) { if (((StringType) sm).getValue().length() > limit) { - sm = new TextType(sm.getXmlElementName(), - ((StringType) sm).getValue().substring(0, limit)); + sm = new TextType(sm.getXmlElementName(), ((StringType) sm).getValue().substring(0, limit)); truncatedMetadataCounted++; } - } else - throw new SEDALibException("Tentative pendant le compactage de troncature " + - "d'une métadonnée [" + sm.getXmlElementName() + "] qui n'est pas de type TextType ou StringType"); + } else throw new SEDALibException( + "Tentative pendant le compactage de troncature " + + "d'une métadonnée [" + + sm.getXmlElementName() + + "] qui n'est pas de type TextType ou StringType" + ); return sm; } @@ -333,18 +339,18 @@ private Content filterContentMetadata(boolean documentFlag, Content originConten } else for (SEDAMetadata sm : originContent.getMetadataList()) { Integer limit = contentMetadataFilter.get(sm.getXmlElementName()); if (limit != null) { - if (limit == 0) - resultContent.getMetadataList().add(sm); - else - resultContent.getMetadataList().add(truncateTextType(sm, limit)); - } else - droppedMetadataCounted++; + if (limit == 0) resultContent.getMetadataList().add(sm); + else resultContent.getMetadataList().add(truncateTextType(sm, limit)); + } else droppedMetadataCounted++; } return resultContent; } - private SubDocument getCompactedSubDocumentArchiveUnit(ArchiveUnit au, String parentAuURI, - List compactedFilesList) throws SEDALibException { + private SubDocument getCompactedSubDocumentArchiveUnit( + ArchiveUnit au, + String parentAuURI, + List compactedFilesList + ) throws SEDALibException { SubDocument subDocument; String auURI; String compactedFileURI; @@ -354,16 +360,16 @@ private SubDocument getCompactedSubDocumentArchiveUnit(ArchiveUnit au, String pa localSubDocumentCounter++; if (au.getTheDataObjectGroup() != null) { for (BinaryDataObject bdo : au.getTheDataObjectGroup().getBinaryDataObjectList()) { - StringType dataObjectVersion= bdo.getMetadataDataObjectVersion(); + StringType dataObjectVersion = bdo.getMetadataDataObjectVersion(); String radical = dataObjectVersion.getValue().split("_")[0]; if (subDocumentObjectVersionFilter.contains(radical)) { - compactedFileURI = getExtendedCompactedFileName(auURI + "-" + dataObjectVersion.getValue(), - bdo.getOnDiskPath()); + compactedFileURI = getExtendedCompactedFileName( + auURI + "-" + dataObjectVersion.getValue(), + bdo.getOnDiskPath() + ); subDocument.addMetadata(new FileObject(bdo, compactedFileURI)); - compactedFilesList.add(new CompactedFile(compactedFileURI, - bdo.getOnDiskPath())); - } else - leafWithDroppedFile++; + compactedFilesList.add(new CompactedFile(compactedFileURI, bdo.getOnDiskPath())); + } else leafWithDroppedFile++; } } for (ArchiveUnit auChild : au.getChildrenAuList().getArchiveUnitList()) { @@ -373,7 +379,8 @@ private SubDocument getCompactedSubDocumentArchiveUnit(ArchiveUnit au, String pa return subDocument; } - private Document getCompactedDocumentArchiveUnit(ArchiveUnit au, RecordGrp parentRecordGrp) throws SEDALibException { + private Document getCompactedDocumentArchiveUnit(ArchiveUnit au, RecordGrp parentRecordGrp) + throws SEDALibException { Document document; String parentRecordGrpID; String auURI; @@ -385,14 +392,15 @@ private Document getCompactedDocumentArchiveUnit(ArchiveUnit au, RecordGrp paren auURI = parentRecordGrpID + "-" + "Document" + documentCounter; if (au.getTheDataObjectGroup() != null) { for (BinaryDataObject bdo : au.getTheDataObjectGroup().getBinaryDataObjectList()) { - StringType dataObjectVersion= bdo.getMetadataDataObjectVersion(); + StringType dataObjectVersion = bdo.getMetadataDataObjectVersion(); String radical = dataObjectVersion.getValue().split("_")[0]; if (documentObjectVersionFilter.contains(radical)) { - compactedFileURI = getExtendedCompactedFileName(auURI + "-" + dataObjectVersion.getValue(), - bdo.getOnDiskPath()); + compactedFileURI = getExtendedCompactedFileName( + auURI + "-" + dataObjectVersion.getValue(), + bdo.getOnDiskPath() + ); document.addMetadata(new FileObject(bdo, compactedFileURI)); - compactedFileList.add(new CompactedFile(compactedFileURI, - bdo.getOnDiskPath())); + compactedFileList.add(new CompactedFile(compactedFileURI, bdo.getOnDiskPath())); } else leafWithDroppedFile++; } } @@ -409,36 +417,43 @@ private Document getCompactedDocumentArchiveUnit(ArchiveUnit au, RecordGrp paren private RecordGrp addTreeNodeChild(ArchiveUnit au, RecordGrp parentRecordGrp) throws SEDALibException { RecordGrp curRecordGrp; - curRecordGrp = new RecordGrp("Node" + treenodeCounter,au.getContent(),au.getManagement()); - if (parentRecordGrp == null) - rootRecordGrp = curRecordGrp; + curRecordGrp = new RecordGrp("Node" + treenodeCounter, au.getContent(), au.getManagement()); + if (parentRecordGrp == null) rootRecordGrp = curRecordGrp; else parentRecordGrp.addMetadata(curRecordGrp); - if (!au.getDataObjectRefList().getDataObjectList().isEmpty()) - treenodeWithDroppedFile++; + if (!au.getDataObjectRefList().getDataObjectList().isEmpty()) treenodeWithDroppedFile++; return curRecordGrp; } - private void recurseCompactArchiveUnit(ArchiveUnit au, RecordGrp parentRecordGrp) throws SEDALibException, InterruptedException { - if (dataObjectPackage.isTouchedInDataObjectPackageId(au.getInDataObjectPackageId())) - return; + private void recurseCompactArchiveUnit(ArchiveUnit au, RecordGrp parentRecordGrp) + throws SEDALibException, InterruptedException { + if (dataObjectPackage.isTouchedInDataObjectPackageId(au.getInDataObjectPackageId())) return; dataObjectPackage.addTouchedInDataObjectPackageId(au.getInDataObjectPackageId()); String descriptionLevel = au.getContent().getSimpleMetadata(DESCRIPTION_LEVEL); if (!"Item".equals(descriptionLevel)) { treenodeCounter++; RecordGrp curRecordGrp = addTreeNodeChild(au, parentRecordGrp); - if ((au.getManagement() != null) || (au.getArchiveUnitProfile() != null)) - treenodeWithDroppedNotDesciptiveMetadata++; - for (ArchiveUnit auChild : au.getChildrenAuList().getArchiveUnitList()) - recurseCompactArchiveUnit(auChild, curRecordGrp); - } else - documentsList.add(getCompactedDocumentArchiveUnit(au, parentRecordGrp)); + if ( + (au.getManagement() != null) || (au.getArchiveUnitProfile() != null) + ) treenodeWithDroppedNotDesciptiveMetadata++; + for (ArchiveUnit auChild : au.getChildrenAuList().getArchiveUnitList()) recurseCompactArchiveUnit( + auChild, + curRecordGrp + ); + } else documentsList.add(getCompactedDocumentArchiveUnit(au, parentRecordGrp)); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - MODULE + counter + " ArchiveUnit compactées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + MODULE + counter + " ArchiveUnit compactées" + ); } - private Path createDocumentPackArchiveFile(int packCount, List compactedFileList) throws SEDALibException { - Path archiveFile = Paths.get(workDirectoryName).toAbsolutePath().resolve("Document" + packCount + (deflatedFlag ? ".zip" : ".tar")); + private Path createDocumentPackArchiveFile(int packCount, List compactedFileList) + throws SEDALibException { + Path archiveFile = Paths.get(workDirectoryName) + .toAbsolutePath() + .resolve("Document" + packCount + (deflatedFlag ? ".zip" : ".tar")); if (deflatedFlag) { try (ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream(archiveFile.toString()))) { @@ -452,13 +467,20 @@ private Path createDocumentPackArchiveFile(int packCount, List co zipout.closeEntry(); } } catch (IOException e) { - throw new SEDALibException("Echec de l'export du fichier du paquet de documents [" - + archiveFile + "]", e); + throw new SEDALibException( + "Echec de l'export du fichier du paquet de documents [" + archiveFile + "]", + e + ); } } else { - try (TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new FileOutputStream(archiveFile.toString()))) { + try ( + TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new FileOutputStream(archiveFile.toString())) + ) { for (CompactedFile compactedFile : compactedFileList) { - TarArchiveEntry e = new TarArchiveEntry(compactedFile.onDiskPath.toFile(), compactedFile.compactedFilename); + TarArchiveEntry e = new TarArchiveEntry( + compactedFile.onDiskPath.toFile(), + compactedFile.compactedFilename + ); tarOut.putArchiveEntry(e); try (FileInputStream fis = new FileInputStream(compactedFile.onDiskPath.toFile())) { IOUtils.copy(fis, tarOut); @@ -466,17 +488,22 @@ private Path createDocumentPackArchiveFile(int packCount, List co tarOut.closeArchiveEntry(); } } catch (IOException e) { - throw new SEDALibException("Echec de l'export du fichier du paquet de documents [" - + archiveFile + "]", e); + throw new SEDALibException( + "Echec de l'export du fichier du paquet de documents [" + archiveFile + "]", + e + ); } } return archiveFile; } - - private void addDocumentPackArchiveUnit(ArchiveUnit rootContainerAU, DocumentPack documentPack, - int documentCount, List compactedFileList, int packCount) - throws SEDALibException, InterruptedException { + private void addDocumentPackArchiveUnit( + ArchiveUnit rootContainerAU, + DocumentPack documentPack, + int documentCount, + List compactedFileList, + int packCount + ) throws SEDALibException, InterruptedException { documentPack.addNewMetadata("DocumentsCount", documentCount); documentPack.addNewMetadata("FileObjectsCount", compactedFileList.size()); Path documentPackFilePath = createDocumentPackArchiveFile(packCount, compactedFileList); @@ -487,14 +514,23 @@ private void addDocumentPackArchiveUnit(ArchiveUnit rootContainerAU, DocumentPac curContent.addMetadata(documentPack); packAu.setContent(curContent); DataObjectGroup dog = new DataObjectGroup(dataObjectPackage, null); - BinaryDataObject bdo = new BinaryDataObject(dataObjectPackage, documentPackFilePath, - documentPackFilePath.getFileName().toString(), "BinaryMaster_1"); + BinaryDataObject bdo = new BinaryDataObject( + dataObjectPackage, + documentPackFilePath, + documentPackFilePath.getFileName().toString(), + "BinaryMaster_1" + ); bdo.extractTechnicalElements(null); dog.addDataObject(bdo); packAu.addDataObjectById(dog.getInDataObjectPackageId()); rootContainerAU.addChildArchiveUnit(packAu); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, " Paquet n°" + packCount + " finalisé", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + " Paquet n°" + packCount + " finalisé", + null + ); } public ArchiveUnit doCompact() throws SEDALibException, InterruptedException { @@ -503,7 +539,8 @@ public ArchiveUnit doCompact() throws SEDALibException, InterruptedException { Files.createDirectories(exportPath); } catch (Exception e) { throw new SEDALibException( - "Création du répertoire de création des conteneurs [" + exportPath + "] impossible\n->" + e.getMessage()); + "Création du répertoire de création des conteneurs [" + exportPath + "] impossible\n->" + e.getMessage() + ); } Date d = new Date(); @@ -518,8 +555,9 @@ public ArchiveUnit doCompact() throws SEDALibException, InterruptedException { dataObjectPackage.resetTouchedInDataObjectPackageIdMap(); dataObjectPackage.resetInOutCounter(); - if (archiveUnit.getContent().getSimpleMetadata(DESCRIPTION_LEVEL).equals("Item")) - throw new SEDALibException("Impossible de compacter l'ArchiveUnit à la racine est un Item"); + if (archiveUnit.getContent().getSimpleMetadata(DESCRIPTION_LEVEL).equals("Item")) throw new SEDALibException( + "Impossible de compacter l'ArchiveUnit à la racine est un Item" + ); recurseCompactArchiveUnit(archiveUnit, null); // create container root ArchiveUnit @@ -545,12 +583,23 @@ public ArchiveUnit doCompact() throws SEDALibException, InterruptedException { for (Document doc : documentsList) { xmlString = doc.toString(); metadataSize += xmlString.length() + xmlString.lines().count() * 4; - if (((metadataSize > packDocumentsMaxMetadataSize) && (documentCount != 0)) || - (documentCount >= packMaxDocumentNumber)) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - MODULE + totalDocumentCount + EXPORTED_DOCUMENTS, null); - addDocumentPackArchiveUnit(rootContainerAU, documentPack, - documentCount, compactedFileList, packCounter); + if ( + ((metadataSize > packDocumentsMaxMetadataSize) && (documentCount != 0)) || + (documentCount >= packMaxDocumentNumber) + ) { + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + MODULE + totalDocumentCount + EXPORTED_DOCUMENTS, + null + ); + addDocumentPackArchiveUnit( + rootContainerAU, + documentPack, + documentCount, + compactedFileList, + packCounter + ); documentPack = new DocumentPack(rootRecordGrp); documentCount = 0; compactedFileList.clear(); @@ -561,17 +610,28 @@ public ArchiveUnit doCompact() throws SEDALibException, InterruptedException { compactedFileList.addAll(compactedFileListMap.get(doc)); documentCount++; totalDocumentCount++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, totalDocumentCount, - MODULE + totalDocumentCount + EXPORTED_DOCUMENTS); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + totalDocumentCount, + MODULE + totalDocumentCount + EXPORTED_DOCUMENTS + ); } - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, - MODULE + totalDocumentCount + EXPORTED_DOCUMENTS, null); - addDocumentPackArchiveUnit(rootContainerAU, documentPack, - documentCount, compactedFileList, packCounter); - - dataObjectPackage.replaceArchiveUnitBy(archiveUnit,rootContainerAU); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, - MODULE + "compactage d'une ArchiveUnit terminée.", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + MODULE + totalDocumentCount + EXPORTED_DOCUMENTS, + null + ); + addDocumentPackArchiveUnit(rootContainerAU, documentPack, documentCount, compactedFileList, packCounter); + + dataObjectPackage.replaceArchiveUnitBy(archiveUnit, rootContainerAU); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + "compactage d'une ArchiveUnit terminée.", + null + ); end = Instant.now(); return rootContainerAU; } @@ -587,20 +647,22 @@ public String getSummary() { result += documentCounter + " documents et "; result += totalSubDocumentCounter + " sous-documents\n"; result += " dans " + packCounter + " paquets de documents\n"; - if (treenodeWithDroppedNotDesciptiveMetadata + treenodeWithDroppedFile + leafWithDroppedFile > 0) - result += " avec\n"; - if (treenodeWithDroppedNotDesciptiveMetadata != 0) - result += " - " + treenodeWithDroppedNotDesciptiveMetadata + " noeuds dans l'arbre de classement dont des métadonnées non descriptives ont été éliminées\n"; - if (treenodeWithDroppedFile != 0) - result += " - " + treenodeWithDroppedFile + " noeuds dans l'arbre de classement dont des objets ont été éliminés\n"; - if (leafWithDroppedFile != 0) - result += " - " + leafWithDroppedFile + " documents ou sous-documents dont des objets ont été éliminés\n"; - if (droppedMetadataCounted != 0) - result += " - " + droppedMetadataCounted + " metadonnées de premier rang qui ont été éliminés\n"; - if (truncatedMetadataCounted != 0) - result += " - " + truncatedMetadataCounted + " metadonnées de premier rang qui ont été tronquées\n"; - if ((start != null) && (end != null)) - result += "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; + if (treenodeWithDroppedNotDesciptiveMetadata + treenodeWithDroppedFile + leafWithDroppedFile > 0) result += + " avec\n"; + if (treenodeWithDroppedNotDesciptiveMetadata != 0) result += + " - " + + treenodeWithDroppedNotDesciptiveMetadata + + " noeuds dans l'arbre de classement dont des métadonnées non descriptives ont été éliminées\n"; + if (treenodeWithDroppedFile != 0) result += + " - " + treenodeWithDroppedFile + " noeuds dans l'arbre de classement dont des objets ont été éliminés\n"; + if (leafWithDroppedFile != 0) result += + " - " + leafWithDroppedFile + " documents ou sous-documents dont des objets ont été éliminés\n"; + if (droppedMetadataCounted != 0) result += + " - " + droppedMetadataCounted + " metadonnées de premier rang qui ont été éliminés\n"; + if (truncatedMetadataCounted != 0) result += + " - " + truncatedMetadataCounted + " metadonnées de premier rang qui ont été tronquées\n"; + if ((start != null) && (end != null)) result += + "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java index 70214b59..97a98dc9 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/DeCompactor.java @@ -169,7 +169,8 @@ public DeCompactor(ArchiveUnit archiveUnit, String workDirectoryName, SEDALibPro this.dataObjectPackage = archiveUnit.getDataObjectPackage(); } - private RecordGrp extractInformationAndRecordGrpFromDocumentContainer(ArchiveUnit archiveUnit) throws SEDALibException { + private RecordGrp extractInformationAndRecordGrpFromDocumentContainer(ArchiveUnit archiveUnit) + throws SEDALibException { DocumentContainer documentContainer; RecordGrp recordGrp = null; @@ -177,8 +178,9 @@ private RecordGrp extractInformationAndRecordGrpFromDocumentContainer(ArchiveUni expectedFileObjectNumber = 0; documentContainer = (DocumentContainer) archiveUnit.getContent().getFirstNamedMetadata("DocumentContainer"); - if (documentContainer == null) - throw new SEDALibException(MODULE + "pas de DocumentContainer dans l'ArchiveUnit"); + if (documentContainer == null) throw new SEDALibException( + MODULE + "pas de DocumentContainer dans l'ArchiveUnit" + ); for (SEDAMetadata sm : documentContainer.getMetadataList()) { switch (sm.getXmlElementName()) { case "DocumentsCount": @@ -191,14 +193,24 @@ private RecordGrp extractInformationAndRecordGrpFromDocumentContainer(ArchiveUni recordGrp = (RecordGrp) sm; break; default: - throw new SEDALibException(MODULE + " metadonnée [" + sm.getXmlElementName() - + "] inattendue dans le DocumentContainer [" - + archiveUnit.getInDataObjectPackageId() + "]", null); + throw new SEDALibException( + MODULE + + " metadonnée [" + + sm.getXmlElementName() + + "] inattendue dans le DocumentContainer [" + + archiveUnit.getInDataObjectPackageId() + + "]", + null + ); } } - if (recordGrp == null) - throw new SEDALibException(MODULE + "pas de RecordGrp dans le DocumentContainer de l'ArchiveUnit [" - + archiveUnit.getInDataObjectPackageId() + "]", null); + if (recordGrp == null) throw new SEDALibException( + MODULE + + "pas de RecordGrp dans le DocumentContainer de l'ArchiveUnit [" + + archiveUnit.getInDataObjectPackageId() + + "]", + null + ); return recordGrp; } @@ -222,20 +234,25 @@ private ArchiveUnit constructArchiveUnitTree(RecordGrp recordGrp) throws SEDALib result.addChildArchiveUnit(constructArchiveUnitTree((RecordGrp) sm)); break; default: - throw new SEDALibException(MODULE + " metadonnée [" + sm.getXmlElementName() - + "] inattendue dans un RecordGrp"); + throw new SEDALibException( + MODULE + " metadonnée [" + sm.getXmlElementName() + "] inattendue dans un RecordGrp" + ); } } - if (nodeName == null) - throw new SEDALibException(MODULE + " manque le nom d'un noeud RecordGrp"); + if (nodeName == null) throw new SEDALibException(MODULE + " manque le nom d'un noeud RecordGrp"); treeNodeNameArchiveUnitMap.put(nodeName, result); int counter = dataObjectPackage.getNextInOutCounter(); - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - MODULE + counter + " ArchiveUnit decompactées"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + MODULE + counter + " ArchiveUnit decompactées" + ); return result; } - private Path extractInformationAndArchiveUnitsFromDocumentPack(ArchiveUnit archiveUnit) throws SEDALibException, InterruptedException { + private Path extractInformationAndArchiveUnitsFromDocumentPack(ArchiveUnit archiveUnit) + throws SEDALibException, InterruptedException { DocumentPack documentPack; RecordGrp recordGrp = null; List documentList = new ArrayList<>(); @@ -244,8 +261,7 @@ private Path extractInformationAndArchiveUnitsFromDocumentPack(ArchiveUnit archi long packExpectedFileObjectNumber = 0; documentPack = (DocumentPack) archiveUnit.getContent().getFirstNamedMetadata("DocumentPack"); - if (documentPack == null) - throw new SEDALibException(MODULE + "pas de DocumentPack dans l'ArchiveUnit"); + if (documentPack == null) throw new SEDALibException(MODULE + "pas de DocumentPack dans l'ArchiveUnit"); for (SEDAMetadata sm : documentPack.getMetadataList()) { switch (sm.getXmlElementName()) { case "DocumentsCount": @@ -256,33 +272,51 @@ private Path extractInformationAndArchiveUnitsFromDocumentPack(ArchiveUnit archi break; case "RecordGrp": recordGrp = (RecordGrp) sm; - if (!recordGrp.toString().equals(containerRecordGrpXMLData)) - throw new SEDALibException(MODULE + " le RecordGrp du DocumentPack [" - + archiveUnit.getInDataObjectPackageId() + "] est inconsistant avec celui du DocumentContainer"); + if (!recordGrp.toString().equals(containerRecordGrpXMLData)) throw new SEDALibException( + MODULE + + " le RecordGrp du DocumentPack [" + + archiveUnit.getInDataObjectPackageId() + + "] est inconsistant avec celui du DocumentContainer" + ); break; case "Document": documentList.add((Document) sm); break; default: - throw new SEDALibException(MODULE + " metadonnée [" + sm.getXmlElementName() - + "] inattendue dans le DocumentPack [" - + archiveUnit.getInDataObjectPackageId() + "]", null); + throw new SEDALibException( + MODULE + + " metadonnée [" + + sm.getXmlElementName() + + "] inattendue dans le DocumentPack [" + + archiveUnit.getInDataObjectPackageId() + + "]", + null + ); } } - if (recordGrp == null) - throw new SEDALibException(MODULE + "pas de RecordGrp dans le DocumentPack de l'ArchiveUnit"); - if (documentList.size() != packExpectedDocumentNumber) - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, - MODULE + "le nombre de Documents est incohérent [prévus " + packExpectedDocumentNumber - + " trouvés " + documentList.size() + "] dans le DocumentPack [" - + archiveUnit.getInDataObjectPackageId() + "]", null); - if (archiveUnit.getContent().getSimpleMetadata(TITLE) == null) - throw new SEDALibException(MODULE + "pas de Title dans l'ArchiveUnit [" - + archiveUnit.getInDataObjectPackageId() + "]"); - Path documentDirPath = workDirectoryPath.resolve(archiveUnit.getContent().getSimpleMetadata(TITLE) - + "-" + archiveUnit.getInDataObjectPackageId()); - for (Document document : documentList) - extractArchiveUnitsFromDocument(document, documentDirPath); + if (recordGrp == null) throw new SEDALibException( + MODULE + "pas de RecordGrp dans le DocumentPack de l'ArchiveUnit" + ); + if (documentList.size() != packExpectedDocumentNumber) doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + + "le nombre de Documents est incohérent [prévus " + + packExpectedDocumentNumber + + " trouvés " + + documentList.size() + + "] dans le DocumentPack [" + + archiveUnit.getInDataObjectPackageId() + + "]", + null + ); + if (archiveUnit.getContent().getSimpleMetadata(TITLE) == null) throw new SEDALibException( + MODULE + "pas de Title dans l'ArchiveUnit [" + archiveUnit.getInDataObjectPackageId() + "]" + ); + Path documentDirPath = workDirectoryPath.resolve( + archiveUnit.getContent().getSimpleMetadata(TITLE) + "-" + archiveUnit.getInDataObjectPackageId() + ); + for (Document document : documentList) extractArchiveUnitsFromDocument(document, documentDirPath); cumulatedPackExpectedDocumentNumber += packExpectedDocumentNumber; cumulatedPackExpectedFileObjectNumber += packExpectedFileObjectNumber; @@ -308,34 +342,44 @@ public void extractArchiveUnitsFromDocument(Document document, Path documentDirP break; case "FileObject": BinaryDataObject bdo = new BinaryDataObject(dataObjectPackage); - bdo.setMetadataList(((FileObject)sm).getMetadataList()); - StringType uri=(StringType) ((FileObject)sm).getFirstNamedMetadata("Uri"); - if (uri!=null) - bdo.setOnDiskPath(documentDirPath.resolve(uri.getValue())); + bdo.setMetadataList(((FileObject) sm).getMetadataList()); + StringType uri = (StringType) ((FileObject) sm).getFirstNamedMetadata("Uri"); + if (uri != null) bdo.setOnDiskPath(documentDirPath.resolve(uri.getValue())); dataObjectGroup.addDataObject(bdo); binaryDataObjectCounter++; break; case "SubDocument": - newArchiveUnit.addChildArchiveUnit(extractArchiveUnitsFromSubDocument((SubDocument) sm, documentDirPath)); + newArchiveUnit.addChildArchiveUnit( + extractArchiveUnitsFromSubDocument((SubDocument) sm, documentDirPath) + ); break; default: - throw new SEDALibException(MODULE + " metadonnée [" + sm.getXmlElementName() - + "] inattendue dans le Document"); + throw new SEDALibException( + MODULE + " metadonnée [" + sm.getXmlElementName() + "] inattendue dans le Document" + ); } } - if (recordGrpID == null) - throw new SEDALibException(MODULE + " le document [" + document.getSimpleMetadata(TITLE) - + "] n'a pas de lien avec l'arbre de positionnement"); - if (!dataObjectGroup.getBinaryDataObjectList().isEmpty()) - newArchiveUnit.addDataObjectById(dataObjectGroup.getInDataObjectPackageId()); + if (recordGrpID == null) throw new SEDALibException( + MODULE + + " le document [" + + document.getSimpleMetadata(TITLE) + + "] n'a pas de lien avec l'arbre de positionnement" + ); + if (!dataObjectGroup.getBinaryDataObjectList().isEmpty()) newArchiveUnit.addDataObjectById( + dataObjectGroup.getInDataObjectPackageId() + ); ArchiveUnit treeArchiveUnit = treeNodeNameArchiveUnitMap.get(recordGrpID); - if (treeArchiveUnit == null) - throw new SEDALibException(MODULE + "mauvaise référence à l'arbre de positionnement du document [" - + document.getSimpleMetadata(TITLE) + "]"); + if (treeArchiveUnit == null) throw new SEDALibException( + MODULE + + "mauvaise référence à l'arbre de positionnement du document [" + + document.getSimpleMetadata(TITLE) + + "]" + ); treeArchiveUnit.addChildArchiveUnit(newArchiveUnit); } - public ArchiveUnit extractArchiveUnitsFromSubDocument(SubDocument subDocument, Path documentDirPath) throws SEDALibException { + public ArchiveUnit extractArchiveUnitsFromSubDocument(SubDocument subDocument, Path documentDirPath) + throws SEDALibException { ArchiveUnit newArchiveUnit = new ArchiveUnit(dataObjectPackage); archiveUnitCounter++; DataObjectGroup dataObjectGroup = new DataObjectGroup(dataObjectPackage, null); @@ -350,23 +394,26 @@ public ArchiveUnit extractArchiveUnitsFromSubDocument(SubDocument subDocument, P break; case "FileObject": BinaryDataObject bdo = new BinaryDataObject(dataObjectPackage); - bdo.setMetadataList(((FileObject)sm).getMetadataList()); - StringType uri=(StringType) ((FileObject)sm).getFirstNamedMetadata("Uri"); - if (uri!=null) - bdo.setOnDiskPath(documentDirPath.resolve(uri.getValue())); + bdo.setMetadataList(((FileObject) sm).getMetadataList()); + StringType uri = (StringType) ((FileObject) sm).getFirstNamedMetadata("Uri"); + if (uri != null) bdo.setOnDiskPath(documentDirPath.resolve(uri.getValue())); dataObjectGroup.addDataObject(bdo); binaryDataObjectCounter++; break; case "SubDocument": - newArchiveUnit.addChildArchiveUnit(extractArchiveUnitsFromSubDocument((SubDocument) sm, documentDirPath)); + newArchiveUnit.addChildArchiveUnit( + extractArchiveUnitsFromSubDocument((SubDocument) sm, documentDirPath) + ); break; default: - throw new SEDALibException(MODULE + " metadonnée [" + sm.getXmlElementName() - + "] inattendue dans le Document"); + throw new SEDALibException( + MODULE + " metadonnée [" + sm.getXmlElementName() + "] inattendue dans le Document" + ); } } - if (!dataObjectGroup.getBinaryDataObjectList().isEmpty()) - newArchiveUnit.addDataObjectById(dataObjectGroup.getInDataObjectPackageId()); + if (!dataObjectGroup.getBinaryDataObjectList().isEmpty()) newArchiveUnit.addDataObjectById( + dataObjectGroup.getInDataObjectPackageId() + ); return newArchiveUnit; } @@ -375,7 +422,11 @@ public ArchiveUnit doDeCompact() throws SEDALibException, InterruptedException { Files.createDirectories(workDirectoryPath); } catch (Exception e) { throw new SEDALibException( - "Création du répertoire de décompression des conteneurs [" + workDirectoryPath + "] impossible\n->" + e.getMessage()); + "Création du répertoire de décompression des conteneurs [" + + workDirectoryPath + + "] impossible\n->" + + e.getMessage() + ); } Date d = new Date(); @@ -397,24 +448,44 @@ public ArchiveUnit doDeCompact() throws SEDALibException, InterruptedException { for (ArchiveUnit packAU : archiveUnit.getChildrenAuList().getArchiveUnitList()) { Path packDirPath = extractInformationAndArchiveUnitsFromDocumentPack(packAU); - if ((packAU.getTheDataObjectGroup() == null) || - (packAU.getTheDataObjectGroup().getBinaryDataObjectList().isEmpty())) - throw new SEDALibException(MODULE + "pas de fichier à décompresser dans l'ArchiveUnit du DocumentPack [" - + packAU.getInDataObjectPackageId() + "]"); - CompressUtility compressUtility = new CompressUtility(packAU.getTheDataObjectGroup().getBinaryDataObjectList().get(0).getOnDiskPath(), packDirPath, "UTF-8", sedaLibProgressLogger); + if ( + (packAU.getTheDataObjectGroup() == null) || + (packAU.getTheDataObjectGroup().getBinaryDataObjectList().isEmpty()) + ) throw new SEDALibException( + MODULE + + "pas de fichier à décompresser dans l'ArchiveUnit du DocumentPack [" + + packAU.getInDataObjectPackageId() + + "]" + ); + CompressUtility compressUtility = new CompressUtility( + packAU.getTheDataObjectGroup().getBinaryDataObjectList().get(0).getOnDiskPath(), + packDirPath, + "UTF-8", + sedaLibProgressLogger + ); compressUtility.unCompress(); } - if (cumulatedPackExpectedDocumentNumber != expectedDocumentNumber) - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, MODULE - + " Erreur: le nombre de documents décompactés n'est pas celui prévu dans le DocumentContainer", null); - if (cumulatedPackExpectedFileObjectNumber != expectedFileObjectNumber) - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, MODULE - + " Erreur: le nombre de fichiers décompactés n'est pas celui prévu dans le DocumentContainer", null); + if (cumulatedPackExpectedDocumentNumber != expectedDocumentNumber) doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + " Erreur: le nombre de documents décompactés n'est pas celui prévu dans le DocumentContainer", + null + ); + if (cumulatedPackExpectedFileObjectNumber != expectedFileObjectNumber) doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + " Erreur: le nombre de fichiers décompactés n'est pas celui prévu dans le DocumentContainer", + null + ); dataObjectPackage.replaceArchiveUnitBy(archiveUnit, decompactedRootArchiveUnit); - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.GLOBAL, - MODULE + "compactage d'une ArchiveUnit terminée.", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + "compactage d'une ArchiveUnit terminée.", + null + ); end = Instant.now(); return decompactedRootArchiveUnit; } @@ -426,12 +497,15 @@ public ArchiveUnit doDeCompact() throws SEDALibException, InterruptedException { */ public String getSummary() { String result = "Decompactage de l'ArchiveUnit [" + archiveUnit.getInDataObjectPackageId() + "]\n"; - result += " avec " + expectedDocumentNumber + " documents et " - + expectedFileObjectNumber + " fichiers\n"; - result += " développé en " + archiveUnitCounter + " ArchiveUnit(s) et " - + binaryDataObjectCounter + " BinaryDataObjects\n"; - if ((start != null) && (end != null)) - result += "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; + result += " avec " + expectedDocumentNumber + " documents et " + expectedFileObjectNumber + " fichiers\n"; + result += + " développé en " + + archiveUnitCounter + + " ArchiveUnit(s) et " + + binaryDataObjectCounter + + " BinaryDataObjects\n"; + if ((start != null) && (end != null)) result += + "effectué en " + Duration.between(start, end).toString().substring(2) + "\n"; return result; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java index f3d79484..9eaa1635 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/process/package-info.java @@ -39,4 +39,4 @@ * Package for building, importing and exporting archive structure and metadata tools * (for high-level usage, see the SIPBuilder class). */ -package fr.gouv.vitam.tools.sedalib.process; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.process; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java index a5e34b96..63f9fca0 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/CompressUtility.java @@ -56,6 +56,7 @@ import static fr.gouv.vitam.tools.sedalib.utils.SEDALibProgressLogger.doProgressLogIfStep; public class CompressUtility { + /** * Log and error string finals. */ @@ -95,7 +96,6 @@ public class CompressUtility { // The uncompressed folder path. private Path uncompressedFolderPath; - /** * Instantiates a new Compress utility. * @@ -104,11 +104,16 @@ public class CompressUtility { * @param encoding the encoding * @param sedaLibProgressLogger the seda lib progress logger */ - public CompressUtility(Path compressedFilePath, Path uncompressedFolderPath, String encoding,SEDALibProgressLogger sedaLibProgressLogger) { - this.compressedFilePath=compressedFilePath; - this.uncompressedFolderPath=uncompressedFolderPath; - this.encoding=encoding; - this.sedaLibProgressLogger=sedaLibProgressLogger; + public CompressUtility( + Path compressedFilePath, + Path uncompressedFolderPath, + String encoding, + SEDALibProgressLogger sedaLibProgressLogger + ) { + this.compressedFilePath = compressedFilePath; + this.uncompressedFolderPath = uncompressedFolderPath; + this.encoding = encoding; + this.sedaLibProgressLogger = sedaLibProgressLogger; } /** @@ -118,8 +123,7 @@ public CompressUtility(Path compressedFilePath, Path uncompressedFolderPath, Str * @return the string */ public static boolean isKnownCompressedMimeType(String mimeType) { - if (mimeType==null) - return false; + if (mimeType == null) return false; switch (mimeType) { case ZIP: case TAR: @@ -133,43 +137,53 @@ public static boolean isKnownCompressedMimeType(String mimeType) { } private ArchiveInputStream createArchiveInputStream(Path compressedFilePath) - throws SEDALibException, InterruptedException { + throws SEDALibException, InterruptedException { String mimeType; - FileInputStream fis=null; - ArchiveInputStream ais=null; + FileInputStream fis = null; + ArchiveInputStream ais = null; try { IdentificationResult ir = DroidIdentifier.getInstance().getIdentificationResult(compressedFilePath); mimeType = ir.getMimeType(); } catch (SEDALibException e) { - throw new SEDALibException(MODULE+ "impossible de faire l'identification de format Droid pour le fichier compressé [" - + compressedFilePath + "]", e); + throw new SEDALibException( + MODULE + + "impossible de faire l'identification de format Droid pour le fichier compressé [" + + compressedFilePath + + "]", + e + ); } try { fis = new FileInputStream(compressedFilePath.toFile()); // NOSONAR keep it open switch (mimeType) { case ZIP: - ais= new ZipArchiveInputStream(fis,encoding); + ais = new ZipArchiveInputStream(fis, encoding); break; case XGZIP: case GZIP: - ais= new TarArchiveInputStream(new GzipCompressorInputStream(fis),encoding); + ais = new TarArchiveInputStream(new GzipCompressorInputStream(fis), encoding); break; case BZIP2: - ais= new TarArchiveInputStream(new BZip2CompressorInputStream(fis),encoding); + ais = new TarArchiveInputStream(new BZip2CompressorInputStream(fis), encoding); break; default: //NOSONAR in a tar, Droid identify the first contained file format - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, - MODULE+ "format " + mimeType - + " de compression inconnu, essai d'utilisation du format tar.",null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + MODULE + "format " + mimeType + " de compression inconnu, essai d'utilisation du format tar.", + null + ); case TAR: - ais= new TarArchiveInputStream(fis,encoding); + ais = new TarArchiveInputStream(fis, encoding); break; } } catch (IOException e) { - throw new SEDALibException(MODULE+ "impossible d'ouvrir le fichier compressé [" - + compressedFilePath + "]", e); + throw new SEDALibException( + MODULE + "impossible d'ouvrir le fichier compressé [" + compressedFilePath + "]", + e + ); } return ais; } @@ -180,8 +194,7 @@ private ArchiveInputStream createArchiveInputStream(Path compressedFilePath) * @throws SEDALibException the seda lib exception * @throws InterruptedException the interrupted exception */ - public void unCompress() - throws SEDALibException, InterruptedException { + public void unCompress() throws SEDALibException, InterruptedException { int counter = 0; try (final ArchiveInputStream archiveInputStream = createArchiveInputStream(compressedFilePath)) { @@ -194,8 +207,14 @@ public void unCompress() String entryName = entry.getName(); if (entryName.contains("?")) { entryName = entryName.replace("?", "_"); - doProgressLog(sedaLibProgressLogger,SEDALibProgressLogger.GLOBAL, - "Le nom du fichier [" + entryName + "] a un problème d'encodage, le(s) caratère(s) problématique à été rempalcé par _ ", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.GLOBAL, + "Le nom du fichier [" + + entryName + + "] a un problème d'encodage, le(s) caratère(s) problématique à été rempalcé par _ ", + null + ); } final Path target = uncompressedFolderPath.resolve(entryName); final Path parent = target.getParent(); @@ -204,12 +223,20 @@ public void unCompress() Files.createDirectories(parent); } if (!entry.isDirectory()) { - doProgressLog(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS, - MODULE+"décompresse le fichier [" + entryName + "]", null); + doProgressLog( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS, + MODULE + "décompresse le fichier [" + entryName + "]", + null + ); Files.copy(archiveInputStream, target, StandardCopyOption.REPLACE_EXISTING); counter++; - doProgressLogIfStep(sedaLibProgressLogger, SEDALibProgressLogger.OBJECTS_GROUP, counter, - MODULE+counter + " fichiers extraits"); + doProgressLogIfStep( + sedaLibProgressLogger, + SEDALibProgressLogger.OBJECTS_GROUP, + counter, + MODULE + counter + " fichiers extraits" + ); } else if (!Files.exists(target)) { Files.createDirectories(target); } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java index 1648b64f..79af6d1f 100755 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtil.java @@ -49,7 +49,9 @@ */ public final class LocalDateTimeUtil { - private static final DateTimeFormatter ZONED_DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm[:ss][.SSS][zz]"); + private static final DateTimeFormatter ZONED_DATE_TIME_FORMAT = DateTimeFormatter.ofPattern( + "yyyy-MM-dd'T'HH:mm[:ss][.SSS][zz]" + ); private static final DateTimeFormatter SLASHED_DATE = DateTimeFormatter.ofPattern("dd/MM/yyyy"); /** @@ -104,5 +106,4 @@ public static String getFormattedDateTime(FileTime fileTime) { LocalDateTime ldt = LocalDateTime.ofInstant(fileTime.toInstant(), ZoneId.systemDefault()); return LocalDateTimeUtil.getFormattedDateTime(ldt); } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java index 499a5557..035b02cf 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibException.java @@ -56,7 +56,7 @@ public class SEDALibException extends Exception { public SEDALibException(String message) { super(message); } - + /** * Instantiates a new SEDALib exception. * diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java index 1525daa0..78356c99 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/SEDALibProgressLogger.java @@ -85,7 +85,6 @@ public class SEDALibProgressLogger { */ @FunctionalInterface public interface ProgressLogFunc { - /** * Do progress log. * @@ -187,7 +186,13 @@ public SEDALibProgressLogger(Logger logger, int progressLogLevel, ProgressLogFun * @param step the step value * @param stepDuration the step duration in seconds */ - public SEDALibProgressLogger(Logger logger, int progressLogLevel, ProgressLogFunc progressConsumer, int step, int stepDuration) { + public SEDALibProgressLogger( + Logger logger, + int progressLogLevel, + ProgressLogFunc progressConsumer, + int step, + int stepDuration + ) { this.progressLogFunc = progressConsumer; this.logger = logger; this.step = step; @@ -209,8 +214,15 @@ public SEDALibProgressLogger(Logger logger, int progressLogLevel, ProgressLogFun * @param stepDuration the duration threshold in seconds for triggering progress logs * @param progressFuncLogLevel the log level for the progress consumer function */ - public SEDALibProgressLogger(Logger logger, int progressLogLevel, ProgressLogFunc progressConsumer, - int step, int stepDuration, int progressFuncLogLevel, int progressFuncStep) { + public SEDALibProgressLogger( + Logger logger, + int progressLogLevel, + ProgressLogFunc progressConsumer, + int step, + int stepDuration, + int progressFuncLogLevel, + int progressFuncStep + ) { this.progressLogFunc = progressConsumer; this.logger = logger; this.step = step; @@ -249,8 +261,7 @@ public boolean getDebugFlag() { public static String getMessagesStackString(Throwable e) { String result; result = "-> " + e.getMessage(); - if (e.getCause() instanceof Exception) - result += "\n" + getMessagesStackString(e.getCause()); + if (e.getCause() instanceof Exception) result += "\n" + getMessagesStackString(e.getCause()); return result; } @@ -270,8 +281,8 @@ private static String getJavaStackString(Throwable e) { public static String getAllJavaStackString(Throwable e) { String result; result = getJavaStackString(e); - if (e.getCause() instanceof Exception) - result += "\n------------------------------------\n" + getJavaStackString(e.getCause()); + if (e.getCause() instanceof Exception) result += + "\n------------------------------------\n" + getJavaStackString(e.getCause()); return result; } @@ -286,13 +297,11 @@ public static String getAllJavaStackString(Throwable e) { public static void doProgressLogWithoutInterruption(SEDALibProgressLogger spl, int level, String log, Throwable e) { if (spl != null) { if (level <= spl.progressLogLevel) { - if (e != null) - log += "\n" + getMessagesStackString(e); + if (e != null) log += "\n" + getMessagesStackString(e); if ((spl.progressLogFunc != null) && (level <= spl.progressFuncLogLevel)) { spl.progressLogFunc.doProgressLog(-1, log); } - if ((e != null) && spl.debugFlag) - log += "\n" + getAllJavaStackString(e); + if ((e != null) && spl.debugFlag) log += "\n" + getAllJavaStackString(e); spl.log(level, log); } } @@ -320,7 +329,8 @@ public static void doProgressLogIfDebug(SEDALibProgressLogger spl, String log, T * @param e the exception * @throws InterruptedException the interrupted exception */ - public static void doProgressLog(SEDALibProgressLogger spl, int level, String log, Exception e) throws InterruptedException { + public static void doProgressLog(SEDALibProgressLogger spl, int level, String log, Exception e) + throws InterruptedException { if (spl != null) { doProgressLogWithoutInterruption(spl, level, log, e); Thread.sleep(1); @@ -336,13 +346,15 @@ public static void doProgressLog(SEDALibProgressLogger spl, int level, String lo * @param log the log * @throws InterruptedException the interrupted exception */ - public static void doProgressLogIfStep(SEDALibProgressLogger spl, int level, int count, String log) throws InterruptedException { + public static void doProgressLogIfStep(SEDALibProgressLogger spl, int level, int count, String log) + throws InterruptedException { if (spl != null) { if (level <= spl.progressLogLevel) { long nowEpochSeconds = Instant.now().getEpochSecond(); if (spl.stepDuration < nowEpochSeconds - spl.previousStepEpochSeconds) { - if ((spl.progressLogFunc != null) && (level <= spl.progressFuncLogLevel)) - spl.progressLogFunc.doProgressLog(count, (count % spl.progressFuncStep == 0 ? "" : " * ") + log); + if ( + (spl.progressLogFunc != null) && (level <= spl.progressFuncLogLevel) + ) spl.progressLogFunc.doProgressLog(count, (count % spl.progressFuncStep == 0 ? "" : " * ") + log); spl.log(level, log); Thread.sleep(1); spl.previousStepEpochSeconds = nowEpochSeconds; @@ -351,7 +363,7 @@ public static void doProgressLogIfStep(SEDALibProgressLogger spl, int level, int if ((count % spl.step) == 0) { spl.log(level, log); } - if ((spl.progressLogFunc!=null) && (count % spl.progressFuncStep) == 0) { + if ((spl.progressLogFunc != null) && (count % spl.progressFuncStep) == 0) { spl.progressLogFunc.doProgressLog(count, log); Thread.sleep(1); } @@ -366,9 +378,8 @@ public static void doProgressLogIfStep(SEDALibProgressLogger spl, int level, int * @return the string */ public static String readableFileSize(long size) { - if (size <= 0) - return "0"; - final String[] units = new String[]{"B", "kB", "MB", "GB", "TB"}; + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } @@ -391,8 +402,7 @@ private Marker getMarker(int level) { private void log(int level, String message) { if (level <= progressLogLevel) { - if (logger != null) - logger.info(getMarker(level), message); + if (logger != null) logger.info(getMarker(level), message); } } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java index 4c80e42e..2db63856 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestProgressLogger.java @@ -60,11 +60,7 @@ public class DigestProgressLogger { private long lastLogTimestamp; - public DigestProgressLogger( - SEDALibProgressLogger logger, - Path path, - long fileSize - ) { + public DigestProgressLogger(SEDALibProgressLogger logger, Path path, long fileSize) { this.logger = logger; this.filename = extractFilename(path); this.fileSize = fileSize; @@ -105,12 +101,7 @@ private boolean shouldLogNow() { } private void log(long bytesRead) { - doProgressLogWithoutInterruption( - logger, - GLOBAL, - formatMessage(bytesRead), - null - ); + doProgressLogWithoutInterruption(logger, GLOBAL, formatMessage(bytesRead), null); } private String formatMessage(long bytesRead) { @@ -134,8 +125,6 @@ private int computePercent(long bytesReadTotal) { } private static String extractFilename(Path path) { - return (path != null && path.getFileName() != null) - ? path.getFileName().toString() - : "inconnu"; + return (path != null && path.getFileName() != null) ? path.getFileName().toString() : "inconnu"; } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java index 61c872f1..06d58f69 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/DigestSha512.java @@ -52,8 +52,7 @@ public class DigestSha512 { private static final String SHA512_ALGORITHM = "SHA-512"; // Private constructor to hide the implicit public one - private DigestSha512() { - } + private DigestSha512() {} /** * compute SHA-512 digest for a file. diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java index c99e0d90..5a938f60 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/digest/NioDigestComputer.java @@ -55,21 +55,16 @@ public class NioDigestComputer { private static final int MIN_BUFFER_SIZE = 1; private static final int MAX_BUFFER_SIZE = 64 * (int) FileUtils.ONE_KB; - public byte[] compute(MessageDigest digest, Path path, SEDALibProgressLogger logger) - throws SEDALibException { - + public byte[] compute(MessageDigest digest, Path path, SEDALibProgressLogger logger) throws SEDALibException { final long fileSize; try { fileSize = Files.size(path); } catch (IOException e) { - throw new SEDALibException( - String.format("Impossible d'accéder au fichier [%s]", path), e); + throw new SEDALibException(String.format("Impossible d'accéder au fichier [%s]", path), e); } try (FileChannel channel = FileChannel.open(path, READ)) { - - DigestProgressLogger progressLogger = - new DigestProgressLogger(logger, path, fileSize); + DigestProgressLogger progressLogger = new DigestProgressLogger(logger, path, fileSize); final int bufferSize = (int) Math.max(MIN_BUFFER_SIZE, Math.min(fileSize, MAX_BUFFER_SIZE)); ByteBuffer buffer = ByteBuffer.allocateDirect(bufferSize); @@ -88,10 +83,8 @@ public byte[] compute(MessageDigest digest, Path path, SEDALibProgressLogger log progressLogger.logEnd(); return digest.digest(); - } catch (IOException e) { - throw new SEDALibException( - String.format("Impossible de calculer le hash du fichier [%s]", path), e); + throw new SEDALibException(String.format("Impossible de calculer le hash du fichier [%s]", path), e); } } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java index 3af18d8e..121eff1b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/utils/package-info.java @@ -38,4 +38,4 @@ /** * Package for utility classes (exceptions, log...) */ -package fr.gouv.vitam.tools.sedalib.utils; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.utils; diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java index 79d0d9fd..cc9869d9 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/HtmlAndXmlEscape.java @@ -49,7 +49,6 @@ */ public class HtmlAndXmlEscape { - /** * Escapes a given string for XML 1.0 compliance. * @@ -87,7 +86,7 @@ public static String escapeXml(String input) { // Ensure a valid low surrogate exists if (i + 1 < length && Character.isLowSurrogate(input.charAt(i + 1))) { sb.append(c).append(input.charAt(i + 1)); - i++; // Skip to the low surrogate + i++; // Skip to the low surrogate continue; } // If unmatched high surrogate, skip it @@ -99,10 +98,11 @@ public static String escapeXml(String input) { continue; } // Invalid characters according to the XML 1.0 specification - if ((c <= 0x1F && c != '\t' && c != '\n' && c != '\r') || - (c >= 0x7F && c <= 0x84) || - (c >= 0x86 && c <= 0x9F)) - continue; // Ignore invalid characters + if ( + (c <= 0x1F && c != '\t' && c != '\n' && c != '\r') || + (c >= 0x7F && c <= 0x84) || + (c >= 0x86 && c <= 0x9F) + ) continue; // Ignore invalid characters switch (c) { case '&': @@ -129,262 +129,262 @@ public static String escapeXml(String input) { } private static final Map UNESCAPE_MAP = Map.ofEntries( - //ISO8859-1 entities - Map.entry("nbsp", ' '), - Map.entry("iexcl", '¡'), - Map.entry("cent", '¢'), - Map.entry("pound", '£'), - Map.entry("curren", '¤'), - Map.entry("yen", '¥'), - Map.entry("brvbar", '¦'), - Map.entry("sect", '§'), - Map.entry("uml", '¨'), - Map.entry("copy", '©'), - Map.entry("ordf", 'ª'), - Map.entry("laquo", '«'), - Map.entry("not", '¬'), - Map.entry("shy", '­'), - Map.entry("reg", '®'), - Map.entry("macr", '¯'), - Map.entry("deg", '°'), - Map.entry("plusmn", '±'), - Map.entry("sup2", '²'), - Map.entry("sup3", '³'), - Map.entry("acute", '´'), - Map.entry("micro", 'µ'), - Map.entry("para", '¶'), - Map.entry("middot", '·'), - Map.entry("cedil", '¸'), - Map.entry("sup1", '¹'), - Map.entry("ordm", 'º'), - Map.entry("raquo", '»'), - Map.entry("frac14", '¼'), - Map.entry("frac12", '½'), - Map.entry("frac34", '¾'), - Map.entry("iquest", '¿'), - Map.entry("Agrave", 'À'), - Map.entry("Aacute", 'Á'), - Map.entry("Acirc", 'Â'), - Map.entry("Atilde", 'Ã'), - Map.entry("Auml", 'Ä'), - Map.entry("Aring", 'Å'), - Map.entry("AElig", 'Æ'), - Map.entry("Ccedil", 'Ç'), - Map.entry("Egrave", 'È'), - Map.entry("Eacute", 'É'), - Map.entry("Ecirc", 'Ê'), - Map.entry("Euml", 'Ë'), - Map.entry("Igrave", 'Ì'), - Map.entry("Iacute", 'Í'), - Map.entry("Icirc", 'Î'), - Map.entry("Iuml", 'Ï'), - Map.entry("ETH", 'Ð'), - Map.entry("Ntilde", 'Ñ'), - Map.entry("Ograve", 'Ò'), - Map.entry("Oacute", 'Ó'), - Map.entry("Ocirc", 'Ô'), - Map.entry("Otilde", 'Õ'), - Map.entry("Ouml", 'Ö'), - Map.entry("times", '×'), - Map.entry("Oslash", 'Ø'), - Map.entry("Ugrave", 'Ù'), - Map.entry("Uacute", 'Ú'), - Map.entry("Ucirc", 'Û'), - Map.entry("Uuml", 'Ü'), - Map.entry("Yacute", 'Ý'), - Map.entry("THORN", 'Þ'), - Map.entry("szlig", 'ß'), - Map.entry("agrave", 'à'), - Map.entry("aacute", 'á'), - Map.entry("acirc", 'â'), - Map.entry("atilde", 'ã'), - Map.entry("auml", 'ä'), - Map.entry("aring", 'å'), - Map.entry("aelig", 'æ'), - Map.entry("ccedil", 'ç'), - Map.entry("egrave", 'è'), - Map.entry("eacute", 'é'), - Map.entry("ecirc", 'ê'), - Map.entry("euml", 'ë'), - Map.entry("igrave", 'ì'), - Map.entry("iacute", 'í'), - Map.entry("icirc", 'î'), - Map.entry("iuml", 'ï'), - Map.entry("eth", 'ð'), - Map.entry("ntilde", 'ñ'), - Map.entry("ograve", 'ò'), - Map.entry("oacute", 'ó'), - Map.entry("ocirc", 'ô'), - Map.entry("otilde", 'õ'), - Map.entry("ouml", 'ö'), - Map.entry("divide", '÷'), - Map.entry("oslash", 'ø'), - Map.entry("ugrave", 'ù'), - Map.entry("uacute", 'ú'), - Map.entry("ucirc", 'û'), - Map.entry("uuml", 'ü'), - Map.entry("yacute", 'ý'), - Map.entry("thorn", 'þ'), - Map.entry("yuml", 'ÿ'), - // HTML40 Extended entities - Map.entry("fnof", 'ƒ'), - Map.entry("Alpha", 'Α'), - Map.entry("Beta", 'Β'), - Map.entry("Gamma", 'Γ'), - Map.entry("Delta", 'Δ'), - Map.entry("Epsilon", 'Ε'), - Map.entry("Zeta", 'Ζ'), - Map.entry("Eta", 'Η'), - Map.entry("Theta", 'Θ'), - Map.entry("Iota", 'Ι'), - Map.entry("Kappa", 'Κ'), - Map.entry("Lambda", 'Λ'), - Map.entry("Mu", 'Μ'), - Map.entry("Nu", 'Ν'), - Map.entry("Xi", 'Ξ'), - Map.entry("Omicron", 'Ο'), - Map.entry("Pi", 'Π'), - Map.entry("Rho", 'Ρ'), - Map.entry("Sigma", 'Σ'), - Map.entry("Tau", 'Τ'), - Map.entry("Upsilon", 'Υ'), - Map.entry("Phi", 'Φ'), - Map.entry("Chi", 'Χ'), - Map.entry("Psi", 'Ψ'), - Map.entry("Omega", 'Ω'), - Map.entry("alpha", 'α'), - Map.entry("beta", 'β'), - Map.entry("gamma", 'γ'), - Map.entry("delta", 'δ'), - Map.entry("epsilon", 'ε'), - Map.entry("zeta", 'ζ'), - Map.entry("eta", 'η'), - Map.entry("theta", 'θ'), - Map.entry("iota", 'ι'), - Map.entry("kappa", 'κ'), - Map.entry("lambda", 'λ'), - Map.entry("mu", 'μ'), - Map.entry("nu", 'ν'), - Map.entry("xi", 'ξ'), - Map.entry("omicron", 'ο'), - Map.entry("pi", 'π'), - Map.entry("rho", 'ρ'), - Map.entry("sigmaf", 'ς'), - Map.entry("sigma", 'σ'), - Map.entry("tau", 'τ'), - Map.entry("upsilon", 'υ'), - Map.entry("phi", 'φ'), - Map.entry("chi", 'χ'), - Map.entry("psi", 'ψ'), - Map.entry("omega", 'ω'), - Map.entry("thetasym", 'ϑ'), - Map.entry("upsih", 'ϒ'), - Map.entry("piv", 'ϖ'), - Map.entry("bull", '•'), - Map.entry("hellip", '…'), - Map.entry("prime", '′'), - Map.entry("Prime", '″'), - Map.entry("oline", '‾'), - Map.entry("frasl", '⁄'), - Map.entry("weierp", '℘'), - Map.entry("image", 'ℑ'), - Map.entry("real", 'ℜ'), - Map.entry("trade", '™'), - Map.entry("alefsym", 'ℵ'), - Map.entry("larr", '←'), - Map.entry("uarr", '↑'), - Map.entry("rarr", '→'), - Map.entry("darr", '↓'), - Map.entry("harr", '↔'), - Map.entry("crarr", '↵'), - Map.entry("lArr", '⇐'), - Map.entry("uArr", '⇑'), - Map.entry("rArr", '⇒'), - Map.entry("dArr", '⇓'), - Map.entry("hArr", '⇔'), - Map.entry("forall", '∀'), - Map.entry("part", '∂'), - Map.entry("exist", '∃'), - Map.entry("empty", '∅'), - Map.entry("nabla", '∇'), - Map.entry("isin", '∈'), - Map.entry("notin", '∉'), - Map.entry("ni", '∋'), - Map.entry("prod", '∏'), - Map.entry("sum", '∑'), - Map.entry("minus", '−'), - Map.entry("lowast", '∗'), - Map.entry("radic", '√'), - Map.entry("prop", '∝'), - Map.entry("infin", '∞'), - Map.entry("ang", '∠'), - Map.entry("and", '∧'), - Map.entry("or", '∨'), - Map.entry("cap", '∩'), - Map.entry("cup", '∪'), - Map.entry("int", '∫'), - Map.entry("there4", '∴'), - Map.entry("sim", '∼'), - Map.entry("cong", '≅'), - Map.entry("asymp", '≈'), - Map.entry("ne", '≠'), - Map.entry("equiv", '≡'), - Map.entry("le", '≤'), - Map.entry("ge", '≥'), - Map.entry("sub", '⊂'), - Map.entry("sup", '⊃'), - Map.entry("nsub", '⊄'), - Map.entry("sube", '⊆'), - Map.entry("supe", '⊇'), - Map.entry("oplus", '⊕'), - Map.entry("otimes", '⊗'), - Map.entry("perp", '⊥'), - Map.entry("sdot", '⋅'), - Map.entry("lceil", '⌈'), - Map.entry("rceil", '⌉'), - Map.entry("lfloor", '⌊'), - Map.entry("rfloor", '⌋'), - Map.entry("lang", '〈'), - Map.entry("rang", '〉'), - Map.entry("loz", '◊'), - Map.entry("spades", '♠'), - Map.entry("clubs", '♣'), - Map.entry("hearts", '♥'), - Map.entry("diams", '♦'), - Map.entry("OElig", 'Œ'), - Map.entry("oelig", 'œ'), - Map.entry("Scaron", 'Š'), - Map.entry("scaron", 'š'), - Map.entry("Yuml", 'Ÿ'), - Map.entry("circ", 'ˆ'), - Map.entry("tilde", '˜'), - Map.entry("ensp", ' '), - Map.entry("emsp", ' '), - Map.entry("thinsp", ' '), - Map.entry("zwnj", '‌'), - Map.entry("zwj", '‍'), - Map.entry("lrm", '‎'), - Map.entry("rlm", '‏'), - Map.entry("ndash", '–'), - Map.entry("mdash", '—'), - Map.entry("lsquo", '‘'), - Map.entry("rsquo", '’'), - Map.entry("sbquo", '‚'), - Map.entry("ldquo", '“'), - Map.entry("rdquo", '”'), - Map.entry("bdquo", '„'), - Map.entry("dagger", '†'), - Map.entry("Dagger", '‡'), - Map.entry("permil", '‰'), - Map.entry("lsaquo", '‹'), - Map.entry("rsaquo", '›'), - Map.entry("euro", '€'), - // XML entities - Map.entry("quot", '"'), - Map.entry("amp", '&'), - Map.entry("lt", '<'), - Map.entry("gt", '>'), - Map.entry("apos", '\'') + //ISO8859-1 entities + Map.entry("nbsp", ' '), + Map.entry("iexcl", '¡'), + Map.entry("cent", '¢'), + Map.entry("pound", '£'), + Map.entry("curren", '¤'), + Map.entry("yen", '¥'), + Map.entry("brvbar", '¦'), + Map.entry("sect", '§'), + Map.entry("uml", '¨'), + Map.entry("copy", '©'), + Map.entry("ordf", 'ª'), + Map.entry("laquo", '«'), + Map.entry("not", '¬'), + Map.entry("shy", '­'), + Map.entry("reg", '®'), + Map.entry("macr", '¯'), + Map.entry("deg", '°'), + Map.entry("plusmn", '±'), + Map.entry("sup2", '²'), + Map.entry("sup3", '³'), + Map.entry("acute", '´'), + Map.entry("micro", 'µ'), + Map.entry("para", '¶'), + Map.entry("middot", '·'), + Map.entry("cedil", '¸'), + Map.entry("sup1", '¹'), + Map.entry("ordm", 'º'), + Map.entry("raquo", '»'), + Map.entry("frac14", '¼'), + Map.entry("frac12", '½'), + Map.entry("frac34", '¾'), + Map.entry("iquest", '¿'), + Map.entry("Agrave", 'À'), + Map.entry("Aacute", 'Á'), + Map.entry("Acirc", 'Â'), + Map.entry("Atilde", 'Ã'), + Map.entry("Auml", 'Ä'), + Map.entry("Aring", 'Å'), + Map.entry("AElig", 'Æ'), + Map.entry("Ccedil", 'Ç'), + Map.entry("Egrave", 'È'), + Map.entry("Eacute", 'É'), + Map.entry("Ecirc", 'Ê'), + Map.entry("Euml", 'Ë'), + Map.entry("Igrave", 'Ì'), + Map.entry("Iacute", 'Í'), + Map.entry("Icirc", 'Î'), + Map.entry("Iuml", 'Ï'), + Map.entry("ETH", 'Ð'), + Map.entry("Ntilde", 'Ñ'), + Map.entry("Ograve", 'Ò'), + Map.entry("Oacute", 'Ó'), + Map.entry("Ocirc", 'Ô'), + Map.entry("Otilde", 'Õ'), + Map.entry("Ouml", 'Ö'), + Map.entry("times", '×'), + Map.entry("Oslash", 'Ø'), + Map.entry("Ugrave", 'Ù'), + Map.entry("Uacute", 'Ú'), + Map.entry("Ucirc", 'Û'), + Map.entry("Uuml", 'Ü'), + Map.entry("Yacute", 'Ý'), + Map.entry("THORN", 'Þ'), + Map.entry("szlig", 'ß'), + Map.entry("agrave", 'à'), + Map.entry("aacute", 'á'), + Map.entry("acirc", 'â'), + Map.entry("atilde", 'ã'), + Map.entry("auml", 'ä'), + Map.entry("aring", 'å'), + Map.entry("aelig", 'æ'), + Map.entry("ccedil", 'ç'), + Map.entry("egrave", 'è'), + Map.entry("eacute", 'é'), + Map.entry("ecirc", 'ê'), + Map.entry("euml", 'ë'), + Map.entry("igrave", 'ì'), + Map.entry("iacute", 'í'), + Map.entry("icirc", 'î'), + Map.entry("iuml", 'ï'), + Map.entry("eth", 'ð'), + Map.entry("ntilde", 'ñ'), + Map.entry("ograve", 'ò'), + Map.entry("oacute", 'ó'), + Map.entry("ocirc", 'ô'), + Map.entry("otilde", 'õ'), + Map.entry("ouml", 'ö'), + Map.entry("divide", '÷'), + Map.entry("oslash", 'ø'), + Map.entry("ugrave", 'ù'), + Map.entry("uacute", 'ú'), + Map.entry("ucirc", 'û'), + Map.entry("uuml", 'ü'), + Map.entry("yacute", 'ý'), + Map.entry("thorn", 'þ'), + Map.entry("yuml", 'ÿ'), + // HTML40 Extended entities + Map.entry("fnof", 'ƒ'), + Map.entry("Alpha", 'Α'), + Map.entry("Beta", 'Β'), + Map.entry("Gamma", 'Γ'), + Map.entry("Delta", 'Δ'), + Map.entry("Epsilon", 'Ε'), + Map.entry("Zeta", 'Ζ'), + Map.entry("Eta", 'Η'), + Map.entry("Theta", 'Θ'), + Map.entry("Iota", 'Ι'), + Map.entry("Kappa", 'Κ'), + Map.entry("Lambda", 'Λ'), + Map.entry("Mu", 'Μ'), + Map.entry("Nu", 'Ν'), + Map.entry("Xi", 'Ξ'), + Map.entry("Omicron", 'Ο'), + Map.entry("Pi", 'Π'), + Map.entry("Rho", 'Ρ'), + Map.entry("Sigma", 'Σ'), + Map.entry("Tau", 'Τ'), + Map.entry("Upsilon", 'Υ'), + Map.entry("Phi", 'Φ'), + Map.entry("Chi", 'Χ'), + Map.entry("Psi", 'Ψ'), + Map.entry("Omega", 'Ω'), + Map.entry("alpha", 'α'), + Map.entry("beta", 'β'), + Map.entry("gamma", 'γ'), + Map.entry("delta", 'δ'), + Map.entry("epsilon", 'ε'), + Map.entry("zeta", 'ζ'), + Map.entry("eta", 'η'), + Map.entry("theta", 'θ'), + Map.entry("iota", 'ι'), + Map.entry("kappa", 'κ'), + Map.entry("lambda", 'λ'), + Map.entry("mu", 'μ'), + Map.entry("nu", 'ν'), + Map.entry("xi", 'ξ'), + Map.entry("omicron", 'ο'), + Map.entry("pi", 'π'), + Map.entry("rho", 'ρ'), + Map.entry("sigmaf", 'ς'), + Map.entry("sigma", 'σ'), + Map.entry("tau", 'τ'), + Map.entry("upsilon", 'υ'), + Map.entry("phi", 'φ'), + Map.entry("chi", 'χ'), + Map.entry("psi", 'ψ'), + Map.entry("omega", 'ω'), + Map.entry("thetasym", 'ϑ'), + Map.entry("upsih", 'ϒ'), + Map.entry("piv", 'ϖ'), + Map.entry("bull", '•'), + Map.entry("hellip", '…'), + Map.entry("prime", '′'), + Map.entry("Prime", '″'), + Map.entry("oline", '‾'), + Map.entry("frasl", '⁄'), + Map.entry("weierp", '℘'), + Map.entry("image", 'ℑ'), + Map.entry("real", 'ℜ'), + Map.entry("trade", '™'), + Map.entry("alefsym", 'ℵ'), + Map.entry("larr", '←'), + Map.entry("uarr", '↑'), + Map.entry("rarr", '→'), + Map.entry("darr", '↓'), + Map.entry("harr", '↔'), + Map.entry("crarr", '↵'), + Map.entry("lArr", '⇐'), + Map.entry("uArr", '⇑'), + Map.entry("rArr", '⇒'), + Map.entry("dArr", '⇓'), + Map.entry("hArr", '⇔'), + Map.entry("forall", '∀'), + Map.entry("part", '∂'), + Map.entry("exist", '∃'), + Map.entry("empty", '∅'), + Map.entry("nabla", '∇'), + Map.entry("isin", '∈'), + Map.entry("notin", '∉'), + Map.entry("ni", '∋'), + Map.entry("prod", '∏'), + Map.entry("sum", '∑'), + Map.entry("minus", '−'), + Map.entry("lowast", '∗'), + Map.entry("radic", '√'), + Map.entry("prop", '∝'), + Map.entry("infin", '∞'), + Map.entry("ang", '∠'), + Map.entry("and", '∧'), + Map.entry("or", '∨'), + Map.entry("cap", '∩'), + Map.entry("cup", '∪'), + Map.entry("int", '∫'), + Map.entry("there4", '∴'), + Map.entry("sim", '∼'), + Map.entry("cong", '≅'), + Map.entry("asymp", '≈'), + Map.entry("ne", '≠'), + Map.entry("equiv", '≡'), + Map.entry("le", '≤'), + Map.entry("ge", '≥'), + Map.entry("sub", '⊂'), + Map.entry("sup", '⊃'), + Map.entry("nsub", '⊄'), + Map.entry("sube", '⊆'), + Map.entry("supe", '⊇'), + Map.entry("oplus", '⊕'), + Map.entry("otimes", '⊗'), + Map.entry("perp", '⊥'), + Map.entry("sdot", '⋅'), + Map.entry("lceil", '⌈'), + Map.entry("rceil", '⌉'), + Map.entry("lfloor", '⌊'), + Map.entry("rfloor", '⌋'), + Map.entry("lang", '〈'), + Map.entry("rang", '〉'), + Map.entry("loz", '◊'), + Map.entry("spades", '♠'), + Map.entry("clubs", '♣'), + Map.entry("hearts", '♥'), + Map.entry("diams", '♦'), + Map.entry("OElig", 'Œ'), + Map.entry("oelig", 'œ'), + Map.entry("Scaron", 'Š'), + Map.entry("scaron", 'š'), + Map.entry("Yuml", 'Ÿ'), + Map.entry("circ", 'ˆ'), + Map.entry("tilde", '˜'), + Map.entry("ensp", ' '), + Map.entry("emsp", ' '), + Map.entry("thinsp", ' '), + Map.entry("zwnj", '‌'), + Map.entry("zwj", '‍'), + Map.entry("lrm", '‎'), + Map.entry("rlm", '‏'), + Map.entry("ndash", '–'), + Map.entry("mdash", '—'), + Map.entry("lsquo", '‘'), + Map.entry("rsquo", '’'), + Map.entry("sbquo", '‚'), + Map.entry("ldquo", '“'), + Map.entry("rdquo", '”'), + Map.entry("bdquo", '„'), + Map.entry("dagger", '†'), + Map.entry("Dagger", '‡'), + Map.entry("permil", '‰'), + Map.entry("lsaquo", '‹'), + Map.entry("rsaquo", '›'), + Map.entry("euro", '€'), + // XML entities + Map.entry("quot", '"'), + Map.entry("amp", '&'), + Map.entry("lt", '<'), + Map.entry("gt", '>'), + Map.entry("apos", '\'') ); /** @@ -432,8 +432,8 @@ public static String unescapeHtmlAndXMLEntities(String input) { if (entity.startsWith("#")) { try { int codePoint = entity.startsWith("#x") || entity.startsWith("#X") - ? Integer.parseInt(entity.substring(2), 16) - : Integer.parseInt(entity.substring(1)); + ? Integer.parseInt(entity.substring(2), 16) + : Integer.parseInt(entity.substring(1)); out.appendCodePoint(codePoint); // Java 11-friendly } catch (Exception e) { out.append(full); // on laisse tel quel @@ -457,6 +457,5 @@ public static String unescapeHtmlAndXMLEntities(String input) { * Private constructor to prevent instantiation of the HTMLAndXMLEscape class, * as it is only meant to provide static utility functions. */ - private HtmlAndXmlEscape() { - } -} \ No newline at end of file + private HtmlAndXmlEscape() {} +} diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java index d0e25bbd..f5746670 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/IndentXMLTool.java @@ -126,8 +126,10 @@ private IndentXMLTool(int indentLength) { appTransformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); if (indentLength > 0) { appTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); - appTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", - Integer.toString(indentLength)); + appTransformer.setOutputProperty( + "{http://xml.apache.org/xslt}indent-amount", + Integer.toString(indentLength) + ); } } catch (Exception e) { appTransformer = null; @@ -145,8 +147,7 @@ private IndentXMLTool(int indentLength) { * @return single instance of IndentXMLTool */ public static IndentXMLTool getInstance(int indentLength) { - if ((instance == null) || (instance.indentLength != indentLength)) - instance = new IndentXMLTool(indentLength); + if ((instance == null) || (instance.indentLength != indentLength)) instance = new IndentXMLTool(indentLength); return instance; } @@ -160,19 +161,21 @@ public static IndentXMLTool getInstance(int indentLength) { public String indentString(String xml) throws SEDALibException { String result; - xml=xml.trim(); - if (xml.isEmpty()) - return ""; + xml = xml.trim(); + if (xml.isEmpty()) return ""; - if (appTransformer == null) - return xml; + if (appTransformer == null) return xml; DocumentBuilder appDocumentBuilder; try { appDocumentBuilder = dbf.newDocumentBuilder(); // NOSONAR no Doctype risk as all is encapsulated in a tag Document doc = appDocumentBuilder.parse(new InputSource(new StringReader("" + xml + ""))); XPath xPath = xpf.newXPath(); - NodeList nodeList = (NodeList) xPath.evaluate("//text()[normalize-space()='']", doc, XPathConstants.NODESET); + NodeList nodeList = (NodeList) xPath.evaluate( + "//text()[normalize-space()='']", + doc, + XPathConstants.NODESET + ); for (int i = 0; i < nodeList.getLength(); ++i) { Node node = nodeList.item(i); @@ -187,23 +190,26 @@ public String indentString(String xml) throws SEDALibException { result = stringWriter.toString(); result = result.substring(0, result.lastIndexOf("") - 1).substring(9); // trim beginning CR - while (result.startsWith("\n")) - result = result.substring(1); + while (result.startsWith("\n")) result = result.substring(1); StringBuilder sb = new StringBuilder(); String tmp; try (Scanner s = new Scanner(result)) { while (s.hasNextLine()) { tmp = s.nextLine(); - if (tmp.startsWith(indentElement) && tmp.trim().startsWith("<")) - tmp = tmp.substring(indentLength); + if (tmp.startsWith(indentElement) && tmp.trim().startsWith("<")) tmp = tmp.substring(indentLength); sb.append(tmp).append('\n'); } } - if (sb.length() > 1) - sb.setLength(sb.length() - 1); + if (sb.length() > 1) sb.setLength(sb.length() - 1); return sb.toString(); - } catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException | TransformerException e) { + } catch ( + ParserConfigurationException + | SAXException + | IOException + | XPathExpressionException + | TransformerException e + ) { throw new SEDALibException("XML mal formé", e); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java index 2b84c51a..67b9996e 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLEventReader.java @@ -85,8 +85,10 @@ public class SEDAXMLEventReader implements AutoCloseable { xmlif = XMLInputFactory.newInstance(); xmlifFragments = XMLInputFactory2.newInstance(); // Warning it's a Woodstox specific mode - xmlifFragments.setProperty(WstxInputProperties.P_INPUT_PARSING_MODE, - WstxInputProperties.PARSING_MODE_FRAGMENT); + xmlifFragments.setProperty( + WstxInputProperties.P_INPUT_PARSING_MODE, + WstxInputProperties.PARSING_MODE_FRAGMENT + ); xmlof = XMLOutputFactory.newInstance(); xmlofFragments = XMLOutputFactory2.newInstance(); xmlofFragments.setProperty(WstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTURE, false); @@ -110,21 +112,20 @@ public class SEDAXMLEventReader implements AutoCloseable { public static String extractNamedElement(String elementName, String xmlString) { String result = null; - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { - + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { XMLEvent event = xmlReader.nextUsefullEvent(); while (true) { if (event.isStartElement() && event.asStartElement().getName().getLocalPart().equals(elementName)) { event = xmlReader.nextUsefullEvent(); - if (event.isCharacters()) - result = event.asCharacters().getData(); + if (event.isCharacters()) result = event.asCharacters().getData(); break; } event = xmlReader.nextUsefullEvent(); } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} return result; } @@ -137,8 +138,10 @@ public static String extractNamedElement(String elementName, String xmlString) { */ public static String extractFragments(String elementName, String xmlData) { StringWriter sw = new StringWriter(); - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true)) { + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlData.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais, true) + ) { XMLEvent event = xmlReader.nextUsefullEvent(); while (true) { if (event.isStartElement() && event.asStartElement().getName().getLocalPart().equals(elementName)) { @@ -147,19 +150,19 @@ public static String extractFragments(String elementName, String xmlData) { while (xmlReader.xmlReader.hasNext()) { event = xmlReader.xmlReader.nextEvent(); - if (event.isStartElement() - && ((StartElement) event).getName().getLocalPart().equals(elementName)) - count++; - else if (event.isEndElement() - && ((EndElement) event).getName().getLocalPart().equals(elementName)) { + if ( + event.isStartElement() && + ((StartElement) event).getName().getLocalPart().equals(elementName) + ) count++; + else if ( + event.isEndElement() && ((EndElement) event).getName().getLocalPart().equals(elementName) + ) { count--; - if (count == 0) - break; + if (count == 0) break; } xw.add(event); } - if (xw != null) - xw.close(); + if (xw != null) xw.close(); return sw.toString(); } event = xmlReader.nextUsefullEvent(); @@ -193,17 +196,14 @@ public SEDAXMLEventReader(InputStream is, boolean isForElements) throws SEDALibE InputStreamReader readerFIS = null; try { readerFIS = new InputStreamReader(is, StandardCharsets.UTF_8); - if (isForElements) - xmlReader = xmlifFragments.createXMLEventReader(readerFIS); - else - xmlReader = xmlif.createXMLEventReader(readerFIS); + if (isForElements) xmlReader = xmlifFragments.createXMLEventReader(readerFIS); + else xmlReader = xmlif.createXMLEventReader(readerFIS); } catch (Exception e) { - if (readerFIS != null) - try { - readerFIS.close(); - } catch (IOException e1) { - // too bad - } + if (readerFIS != null) try { + readerFIS.close(); + } catch (IOException e1) { + // too bad + } throw new SEDALibException("Impossible d'ouvrir un flux de lecture XML", e); } } @@ -257,8 +257,7 @@ public static LocalDate getDateFromString(String dateString) throws DateTimePars public String peekName() throws XMLStreamException { XMLEvent event = peekUsefullEvent(); - if (!event.isStartElement()) - return null; + if (!event.isStartElement()) return null; return event.asStartElement().getName().getLocalPart(); } @@ -272,8 +271,10 @@ public XMLEvent peekUsefullEvent() throws XMLStreamException { XMLEvent result; result = xmlReader.peek(); - while ((result.getEventType() == XMLEvent.COMMENT) - || (result.isCharacters() && result.asCharacters().isWhiteSpace())) { + while ( + (result.getEventType() == XMLEvent.COMMENT) || + (result.isCharacters() && result.asCharacters().isWhiteSpace()) + ) { xmlReader.nextEvent(); result = xmlReader.peek(); } @@ -293,8 +294,7 @@ public String peekAttribute(String attribute) throws XMLStreamException { if (peek.isStartElement()) { Attribute a = peek.asStartElement().getAttributeByName(new QName(attribute)); - if (a != null) - result = a.getValue(); + if (a != null) result = a.getValue(); } return result; } @@ -313,8 +313,7 @@ public String peekAttribute(String namespace, String attribute) throws XMLStream if (peek.isStartElement()) { Attribute a = peek.asStartElement().getAttributeByName(new QName(namespace, attribute)); - if (a != null) - result = a.getValue(); + if (a != null) result = a.getValue(); } return result; } @@ -329,9 +328,10 @@ public XMLEvent nextUsefullEvent() throws XMLStreamException { XMLEvent result; result = xmlReader.nextEvent(); - while ((result.getEventType() == XMLEvent.COMMENT) - || (result.isCharacters() && result.asCharacters().isWhiteSpace())) - result = xmlReader.nextEvent(); + while ( + (result.getEventType() == XMLEvent.COMMENT) || + (result.isCharacters() && result.asCharacters().isWhiteSpace()) + ) result = xmlReader.nextEvent(); return result; } @@ -345,10 +345,8 @@ public XMLEvent nextUsefullEvent() throws XMLStreamException { public boolean nextBlockIfNamed(String tag) throws XMLStreamException { XMLEvent peek = peekUsefullEvent(); - if (!peek.isStartElement()) - return false; - if (!tag.equals(peek.asStartElement().getName().getLocalPart())) - return false; + if (!peek.isStartElement()) return false; + if (!tag.equals(peek.asStartElement().getName().getLocalPart())) return false; nextUsefullEvent(); return true; } @@ -363,8 +361,7 @@ public boolean nextBlockIfNamed(String tag) throws XMLStreamException { public boolean peekBlockIfNamed(String tag) throws XMLStreamException { XMLEvent peek = peekUsefullEvent(); - if (!peek.isStartElement()) - return false; + if (!peek.isStartElement()) return false; return tag.equals(peek.asStartElement().getName().getLocalPart()); } @@ -400,10 +397,10 @@ public String peekAttributeBlockIfNamed(String tag, String attribute) throws XML public void endBlockNamed(String tag) throws XMLStreamException, SEDALibException { XMLEvent event = nextUsefullEvent(); - if (!event.isEndElement()) - throw new SEDALibException("Elément " + tag + " mal terminé"); - if (!tag.equals(event.asEndElement().getName().getLocalPart())) - throw new SEDALibException("Elément " + tag + " mal terminé"); + if (!event.isEndElement()) throw new SEDALibException("Elément " + tag + " mal terminé"); + if (!tag.equals(event.asEndElement().getName().getLocalPart())) throw new SEDALibException( + "Elément " + tag + " mal terminé" + ); } /** @@ -425,10 +422,10 @@ public String nextValueIfNamed(String tag) throws XMLStreamException, SEDALibExc result = event.asCharacters().getData(); event = nextUsefullEvent(); } - if (!event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag)) - throw new SEDALibException("Elément " + tag + " mal formé"); - if (result == null) - result = ""; + if ( + !event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag) + ) throw new SEDALibException("Elément " + tag + " mal formé"); + if (result == null) result = ""; } return result; } @@ -453,8 +450,9 @@ public LocalDateTime nextDateValueIfNamed(String tag) throws XMLStreamException, tmp = event.asCharacters().getData(); event = nextUsefullEvent(); } - if (!event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag) || (tmp == null)) - throw new SEDALibException("Elément date " + tag + " mal formé"); + if ( + !event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag) || (tmp == null) + ) throw new SEDALibException("Elément date " + tag + " mal formé"); try { result = getDateTimeFromString(tmp); } catch (DateTimeParseException e) { @@ -484,8 +482,9 @@ public Boolean nextBooleanValueIfNamed(String tag) throws XMLStreamException, SE tmp = event.asCharacters().getData(); event = nextUsefullEvent(); } - if (!event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag) || (tmp == null)) - throw new SEDALibException("Elément booléen " + tag + " mal formé"); + if ( + !event.isEndElement() || !event.asEndElement().getName().getLocalPart().equals(tag) || (tmp == null) + ) throw new SEDALibException("Elément booléen " + tag + " mal formé"); switch (tmp) { case "true": case "1": @@ -512,8 +511,7 @@ public Boolean nextBooleanValueIfNamed(String tag) throws XMLStreamException, SE * @throws SEDALibException the SEDALibException */ public String nextMandatoryValue(String tag) throws XMLStreamException, SEDALibException { - if (!peekBlockIfNamed(tag)) - throw new SEDALibException("Element " + tag + " non trouvé"); + if (!peekBlockIfNamed(tag)) throw new SEDALibException("Element " + tag + " non trouvé"); return nextValueIfNamed(tag); } @@ -536,19 +534,15 @@ public String nextBlockAsStringIfNamed(String tag) throws XMLStreamException { while (xmlReader.hasNext()) { event = xmlReader.nextEvent(); xw.add(event); - if (event.isStartElement() && ((StartElement) event).getName().getLocalPart().equals(tag)) - count++; + if (event.isStartElement() && ((StartElement) event).getName().getLocalPart().equals(tag)) count++; else if (event.isEndElement() && ((EndElement) event).getName().getLocalPart().equals(tag)) { count--; - if (count == 0) - break; + if (count == 0) break; } } - if (xw != null) - xw.close(); + if (xw != null) xw.close(); return sw.toString(); - } else - return null; + } else return null; } /** @@ -561,8 +555,7 @@ else if (event.isEndElement() && ((EndElement) event).getName().getLocalPart().e * @throws SEDALibException if the next block is not a "tag" element */ public String nextMandatoryBlockAsString(String tag) throws XMLStreamException, SEDALibException { - if (!peekBlockIfNamed(tag)) - throw new SEDALibException("Elément " + tag + " non trouvé"); + if (!peekBlockIfNamed(tag)) throw new SEDALibException("Elément " + tag + " non trouvé"); return nextBlockAsStringIfNamed(tag); } } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java index 1b90e805..fdcb6b9b 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLStreamWriter.java @@ -169,10 +169,8 @@ public SEDAXMLStreamWriter(OutputStream os, int indentLength, boolean isForEleme // for xml raw writing rawWriter = new OutputStreamWriter(os, StandardCharsets.UTF_8); // for xml indentend structured writing - if (isForElements) - xmlWriter = xmlofFragments.createXMLStreamWriter(rawWriter); - else - xmlWriter = xmlof.createXMLStreamWriter(rawWriter); + if (isForElements) xmlWriter = xmlofFragments.createXMLStreamWriter(rawWriter); + else xmlWriter = xmlof.createXMLStreamWriter(rawWriter); } catch (Exception e) { throw new SEDALibException("Impossible d'ouvrir un flux d'écriture XML", e); } @@ -203,11 +201,8 @@ void resetIdCounter() { */ public void setXmlId(boolean prefix) throws XMLStreamException { - if (prefix) - xmlWriter.writeAttribute("xml", "xml", "id", "ID" + Integer.toString(idCounter++)); - else - xmlWriter.writeAttribute("id", "ID" + Integer.toString(idCounter++)); - + if (prefix) xmlWriter.writeAttribute("xml", "xml", "id", "ID" + Integer.toString(idCounter++)); + else xmlWriter.writeAttribute("id", "ID" + Integer.toString(idCounter++)); } /** @@ -244,10 +239,8 @@ public void writeBooleanElementValue(String element, Boolean value) throws XMLSt } else { writeStartIndent(); xmlWriter.writeStartElement(element); - if (value) - xmlWriter.writeCharacters("true"); - else - xmlWriter.writeCharacters("false"); + if (value) xmlWriter.writeCharacters("true"); + else xmlWriter.writeCharacters("false"); writeEndIndent(); xmlWriter.writeEndElement(); } @@ -264,9 +257,7 @@ public void writeBooleanElementValue(String element, Boolean value) throws XMLSt public void writeElementValueWithDefault(String element, String value, String def) throws XMLStreamException { if ((value == null) || value.isEmpty()) { writeElementValue(element, def); - } else - writeElementValue(element, value); - + } else writeElementValue(element, value); } /** @@ -277,8 +268,7 @@ public void writeElementValueWithDefault(String element, String value, String de * @throws XMLStreamException the XML stream exception */ public void writeElementValueIfNotEmpty(String element, String value) throws XMLStreamException { - if ((value != null) && !value.isEmpty()) - writeElementValue(element, value); + if ((value != null) && !value.isEmpty()) writeElementValue(element, value); } /** @@ -289,8 +279,7 @@ public void writeElementValueIfNotEmpty(String element, String value) throws XML * @throws XMLStreamException the XML stream exception */ public void writeElementValueIfNotEmpty(String element, Boolean value) throws XMLStreamException { - if (value != null) - writeBooleanElementValue(element, value); + if (value != null) writeBooleanElementValue(element, value); } /** @@ -336,7 +325,6 @@ public void writeRawXMLBlockIfNotEmpty(String rawXml) throws XMLStreamException xmlWriter.flush(); try { - String identXml; if (indentFlag) { // indent line by line the raw block @@ -347,24 +335,20 @@ public void writeRawXMLBlockIfNotEmpty(String rawXml) throws XMLStreamException String line; while (s.hasNextLine()) { line = s.nextLine(); - if (line.trim().startsWith("<")) - sb.append(StringUtils.repeat(indentElement, depth)); + if (line.trim().startsWith("<")) sb.append(StringUtils.repeat(indentElement, depth)); sb.append(line).append('\n'); } s.close(); - if (sb.length() > 1) - sb.setLength(sb.length() - 1); + if (sb.length() > 1) sb.setLength(sb.length() - 1); identXml = "\n" + sb.toString(); } catch (Exception e) { identXml = "\n" + rawXml; } - } else - identXml = rawXml; + } else identXml = rawXml; rawWriter.write(identXml); rawWriter.flush(); - if ((indentFlag) && (depth > 0)) - hasChildElement.put(depth - 1, true); + if ((indentFlag) && (depth > 0)) hasChildElement.put(depth - 1, true); } catch (IOException e) { throw new XMLStreamException("Erreur d'écriture d'un bloc Raw XML", e); } @@ -418,8 +402,7 @@ public void writeAttribute(String localName, String value) throws XMLStreamExcep * @throws XMLStreamException the XML stream exception */ public void writeAttributeIfNotEmpty(String localName, String value) throws XMLStreamException { - if ((value != null) && !value.isEmpty()) - writeAttribute(localName, value); + if ((value != null) && !value.isEmpty()) writeAttribute(localName, value); } /** @@ -432,7 +415,7 @@ public void writeAttributeIfNotEmpty(String localName, String value) throws XMLS * @throws XMLStreamException the XML stream exception */ public void writeAttribute(String prefix, String namespaceURI, String localName, String value) - throws XMLStreamException { + throws XMLStreamException { xmlWriter.writeAttribute(prefix, namespaceURI, localName, value); } @@ -453,8 +436,7 @@ public void writeCharacters(String text) throws XMLStreamException { * @throws XMLStreamException the XML stream exception */ public void writeCharactersIfNotEmpty(String text) throws XMLStreamException { - if ((text != null) && !text.isEmpty()) - xmlWriter.writeCharacters(text); + if ((text != null) && !text.isEmpty()) xmlWriter.writeCharacters(text); } /** @@ -540,10 +522,8 @@ private void writeStartIndent() throws XMLStreamException { // reset state of current node hasChildElement.put(depth, false); // indent for current depth - if (firstLineFlag) - firstLineFlag = false; - else - xmlWriter.writeCharacters(LINEFEED_CHAR); + if (firstLineFlag) firstLineFlag = false; + else xmlWriter.writeCharacters(LINEFEED_CHAR); xmlWriter.writeCharacters(StringUtils.repeat(indentElement, depth)); depth++; } @@ -560,10 +540,8 @@ private void writeEmptyIndent() throws XMLStreamException { hasChildElement.put(depth - 1, true); } // indent for current depth - if (firstLineFlag) - firstLineFlag = false; - else - xmlWriter.writeCharacters(LINEFEED_CHAR); + if (firstLineFlag) firstLineFlag = false; + else xmlWriter.writeCharacters(LINEFEED_CHAR); xmlWriter.writeCharacters(StringUtils.repeat(indentElement, depth)); } } @@ -582,5 +560,4 @@ private void writeEndIndent() throws XMLStreamException { } } } - } diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java index 9ee237b1..8434bea4 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/SEDAXMLValidator.java @@ -72,11 +72,17 @@ public class SEDAXMLValidator { public static Schema getSEDASchema() throws SEDALibException { switch (SedaContext.getVersion()) { case V2_1: - return getSchemaFromXSDResource(SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_1)); + return getSchemaFromXSDResource( + SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_1) + ); case V2_2: - return getSchemaFromXSDResource(SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_2)); + return getSchemaFromXSDResource( + SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_2) + ); case V2_3: - return getSchemaFromXSDResource(SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_3)); + return getSchemaFromXSDResource( + SEDAXMLValidator.class.getClassLoader().getResource(SEDA_VITAM_VALIDATION_RESOURCE_2_3) + ); default: throw new SEDALibException("Version [" + SedaContext.getVersion() + "] sans schéma", null); } @@ -85,11 +91,10 @@ public static Schema getSEDASchema() throws SEDALibException { public static Schema getSchemaFromXSDResource(URL xsdResource) throws SEDALibException { // Was XMLConstants.W3C_XML_SCHEMA_NS_URI try { - SchemaFactory factory = - SchemaFactory.newInstance(HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1); + SchemaFactory factory = SchemaFactory.newInstance(HTTP_WWW_W3_ORG_XML_XML_SCHEMA_V1_1); // Load catalog to resolve external schemas even offline. final URL catalogUrl = SEDAXMLValidator.class.getClassLoader().getResource(CATALOG_FILENAME); - factory.setResourceResolver(new XMLCatalogResolver(new String[]{catalogUrl.toString()}, false)); + factory.setResourceResolver(new XMLCatalogResolver(new String[] { catalogUrl.toString() }, false)); return factory.newSchema(xsdResource); } catch (SAXException e) { @@ -110,7 +115,7 @@ public Schema getSchemaFromXSDFile(String xsdFile) throws SEDALibException { // Load catalog to resolve external schemas even offline. final URL catalogUrl = getClass().getClassLoader().getResource(CATALOG_FILENAME); - factory.setResourceResolver(new XMLCatalogResolver(new String[]{catalogUrl.toString()}, false)); + factory.setResourceResolver(new XMLCatalogResolver(new String[] { catalogUrl.toString() }, false)); return factory.newSchema(new File(xsdFile)); } catch (SAXException e) { @@ -131,7 +136,7 @@ public Schema getSchemaFromRNGFile(String rngFile) throws SEDALibException { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI); // Load catalog to resolve external schemas even offline. final URL catalogUrl = getClass().getClassLoader().getResource(CATALOG_FILENAME); - factory.setResourceResolver(new XMLCatalogResolver(new String[]{catalogUrl.toString()}, false)); + factory.setResourceResolver(new XMLCatalogResolver(new String[] { catalogUrl.toString() }, false)); return factory.newSchema(new File(rngFile)); } catch (SAXException e) { @@ -146,14 +151,22 @@ private String getContextualErrorMessage(String manifest, SAXParseException e) { Scanner scanner = new Scanner(manifest); while (scanner.hasNextLine() && (i < e.getLineNumber())) { line = scanner.nextLine(); - if (line.trim().startsWith(" " - + getContextualErrorMessage(manifest, e)); + throw new SEDALibException("Le flux XML n'est pas conforme\n-> " + getContextualErrorMessage(manifest, e)); } catch (SAXException e) { throw new SEDALibException("Le flux XML n'est pas conforme", e); } finally { @@ -211,8 +223,7 @@ public boolean checkWithRNGSchema(String manifest, Schema rngSchema) throws SEDA validator.validate(new StreamSource(bais)); return true; } catch (SAXParseException e) { - throw new SEDALibException("Le flux XML n'est pas conforme\n-> " - + getContextualErrorMessage(manifest, e)); + throw new SEDALibException("Le flux XML n'est pas conforme\n-> " + getContextualErrorMessage(manifest, e)); } catch (SAXException e) { throw new SEDALibException("Le flux XML n'est pas conforme", e); } catch (IOException e) { diff --git a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java index c567bb90..09973fa6 100644 --- a/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java +++ b/sedalib/src/main/java/fr/gouv/vitam/tools/sedalib/xml/package-info.java @@ -38,4 +38,4 @@ /** * Package for XML manipulation tools (indent, read, write) using STAX */ -package fr.gouv.vitam.tools.sedalib.xml; \ No newline at end of file +package fr.gouv.vitam.tools.sedalib.xml; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java index c67558c8..624dd770 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/SedaContextExtension.java @@ -55,4 +55,3 @@ public void afterEach(ExtensionContext context) { SedaContext.setVersion(null); } } - diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java index 85abc982..7a5015d1 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/TestUtilities.java @@ -60,58 +60,51 @@ private static void createSymbolicLink(String link, String target) throws SEDALi Path targetpath = Paths.get(target); try { Files.delete(linkpath); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { Files.delete(Paths.get(linkpath + ".lnk")); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { Files.createDirectories(linkpath.getParent()); - Files.createSymbolicLink(linkpath.toAbsolutePath(), linkpath.toAbsolutePath().getParent().relativize(targetpath.toAbsolutePath())); + Files.createSymbolicLink( + linkpath.toAbsolutePath(), + linkpath.toAbsolutePath().getParent().relativize(targetpath.toAbsolutePath()) + ); } catch (Exception e) { if (isWindowsOS()) { - System.err.println( - "Link creation is impossible, Windows shortcut creation is tried"); + System.err.println("Link creation is impossible, Windows shortcut creation is tried"); ShellLink sl = new ShellLink(); sl.setTarget(target); try { sl.saveTo(link + ".lnk"); } catch (IOException e1) { throw new SEDALibException( - "Link and Windows shortcut [" + link + "] creation impossible\n->" + e.getMessage()); + "Link and Windows shortcut [" + link + "] creation impossible\n->" + e.getMessage() + ); } - } else - throw new SEDALibException( - "Link [" + link + "] creation impossible\n->" + e.getMessage()); + } else throw new SEDALibException("Link [" + link + "] creation impossible\n->" + e.getMessage()); } } public static void createOrEraseAll(String dirOrFile) { try { Files.createDirectories(Paths.get(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { Files.delete(Paths.get(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { FileUtils.deleteDirectory(new File(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } - private static void createShortcutIfWindows(String link, String target) - throws IOException, SEDALibException { - if (!isWindowsOS()) - createSymbolicLink(link, target); + private static void createShortcutIfWindows(String link, String target) throws IOException, SEDALibException { + if (!isWindowsOS()) createSymbolicLink(link, target); else { Path linkpath = Paths.get(link); try { Files.delete(linkpath); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} ShellLink sl = new ShellLink(); sl.setTarget(target); sl.saveTo(link); @@ -125,24 +118,33 @@ static void ContructTestFiles() throws IOException, SEDALibException { prefix = "src/test/resources/PacketSamples/SampleWithLinksModelV2/Root/"; // regenerate PacketSamples.SampleWithWindowsLinksAndShortcutsModelV2 links createSymbolicLink(prefix + "Link Node 1.2", prefix + "Node 1/Node 1.2"); - createSymbolicLink(prefix + "Link SmallContract.text", - prefix + "Node 2/Node 2.3 - Many/SmallContract.text"); + createSymbolicLink( + prefix + "Link SmallContract.text", + prefix + "Node 2/Node 2.3 - Many/SmallContract.text" + ); createShortcutIfWindows(prefix + "Shortcut Node 2.4 - OG Link.lnk", prefix + "Node 2/Node 2.4 - OG Link"); - createShortcutIfWindows(prefix + "ShortCut OK-RULES-MDRULES.zip.lnk", - prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip"); - createSymbolicLink(prefix + "Node 2/Node 2.4 - OG Link/Link ##Test ObjectGroup##", - prefix + "Node 1/##Test ObjectGroup##"); - createShortcutIfWindows(prefix + "Node 2/Node 2.5 - OG Shortcut/Shortcut ##Test ObjectGroup##.lnk", - prefix + "Node 1/##Test ObjectGroup##"); + createShortcutIfWindows( + prefix + "ShortCut OK-RULES-MDRULES.zip.lnk", + prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip" + ); + createSymbolicLink( + prefix + "Node 2/Node 2.4 - OG Link/Link ##Test ObjectGroup##", + prefix + "Node 1/##Test ObjectGroup##" + ); + createShortcutIfWindows( + prefix + "Node 2/Node 2.5 - OG Shortcut/Shortcut ##Test ObjectGroup##.lnk", + prefix + "Node 1/##Test ObjectGroup##" + ); System.err.println("Test files with links in [" + prefix + "] prepared"); prefix = "src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2/Root/"; // regenerate PacketSamples.SampleWithWindowsLinksAndShortcutsModelV2 links createSymbolicLink(prefix + "Node 1.1", prefix + "Node 1/Node 1.1"); - createSymbolicLink(prefix + "SmallContract.text", - prefix + "Node 2/Node 2.3 - Many/SmallContract.text"); - createShortcutIfWindows(prefix + "OK-RULES-MDRULES.zip.lnk", - prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip"); + createSymbolicLink(prefix + "SmallContract.text", prefix + "Node 2/Node 2.3 - Many/SmallContract.text"); + createShortcutIfWindows( + prefix + "OK-RULES-MDRULES.zip.lnk", + prefix + "Node 2/Node 2.3 - Many/OK-RULES-MDRULES.zip" + ); System.err.println("Test files with links in [" + prefix + "] prepared"); isPrepared = true; } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java index 4566f71a..12b56db4 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/UseTestFiles.java @@ -43,7 +43,6 @@ import java.io.IOException; public interface UseTestFiles { - @BeforeAll static void initializeTestFiles() throws IOException, SEDALibException { TestUtilities.ContructTestFiles(); diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java index 07ac5b92..3209c3bd 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/BinaryDataObjectTest.java @@ -64,7 +64,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; @ExtendWith(SedaContextExtension.class) -@Execution(value = ExecutionMode.SAME_THREAD,reason= "Can't execute different SedaVersion treatment in parallel") +@Execution(value = ExecutionMode.SAME_THREAD, reason = "Can't execute different SedaVersion treatment in parallel") class BinaryDataObjectTest { @Test @@ -78,11 +78,17 @@ void testJson() throws SEDALibException, InterruptedException, IOException { mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - BinaryDataObject bdo = si.getArchiveTransfer().getDataObjectPackage().getBdoInDataObjectPackageIdMap() - .get("ID7"); - bdo.addNewMetadata("Relationship", "tar","typ"); + BinaryDataObject bdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getBdoInDataObjectPackageIdMap() + .get("ID7"); + bdo.addNewMetadata("Relationship", "tar", "typ"); String bdoOut = mapper.writeValueAsString(bdo); //System.out.println("Value to verify=" + bdoOut); @@ -92,97 +98,97 @@ void testJson() throws SEDALibException, InterruptedException, IOException { String bdoNextOut = mapper.writeValueAsString(bdoNext); // Then - String testOut = "{\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"Relationship\",\n" + - " \"elementName\" : \"Relationship\",\n" + - " \"target\" : \"tar\",\n" + - " \"type\" : \"typ\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID7.jpg\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 21232\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Exchangeable Image File Format (Compressed)\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"image/jpeg\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/645\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"image001.jpg\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"Metadata\",\n" + - " \"elementName\" : \"Metadata\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"AnyXMLListType\",\n" + - " \"elementName\" : \"Image\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Dimensions\",\n" + - " \"rawXml\" : \"117x76\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Width\",\n" + - " \"rawXml\" : \"117px\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Height\",\n" + - " \"rawXml\" : \"76px\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"VerticalResolution\",\n" + - " \"rawXml\" : \"96ppp\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"HorizontalResolution\",\n" + - " \"rawXml\" : \"96ppp\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"ColorDepth\",\n" + - " \"rawXml\" : \"24\"\n" + - " } ]\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID7\",\n" + - " \n" + - "}"; + String testOut = + "{\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"Relationship\",\n" + + " \"elementName\" : \"Relationship\",\n" + + " \"target\" : \"tar\",\n" + + " \"type\" : \"typ\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID7.jpg\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 21232\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Exchangeable Image File Format (Compressed)\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"image/jpeg\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/645\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"image001.jpg\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"Metadata\",\n" + + " \"elementName\" : \"Metadata\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"AnyXMLListType\",\n" + + " \"elementName\" : \"Image\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Dimensions\",\n" + + " \"rawXml\" : \"117x76\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Width\",\n" + + " \"rawXml\" : \"117px\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Height\",\n" + + " \"rawXml\" : \"76px\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"VerticalResolution\",\n" + + " \"rawXml\" : \"96ppp\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"HorizontalResolution\",\n" + + " \"rawXml\" : \"96ppp\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"ColorDepth\",\n" + + " \"rawXml\" : \"24\"\n" + + " } ]\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID7\",\n" + + " \n" + + "}"; testOut = TestUtilities.SlackNormalize(testOut.replaceAll("\"onDiskPath\" : .*\"", "")); bdoNextOut = TestUtilities.SlackNormalize(bdoNextOut.replaceAll("\"onDiskPath\" : .*\"", "")); assertThat(bdoNextOut).isEqualToNormalizingNewlines(testOut); - } @Test @@ -196,17 +202,23 @@ void testXMLFragment() throws SEDALibException, InterruptedException, FileNotFou mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); SedaContext.setVersion(SedaVersion.V2_1); si.doImport(); - BinaryDataObject bdo = si.getArchiveTransfer().getDataObjectPackage().getBdoInDataObjectPackageIdMap() - .get("ID7"); + BinaryDataObject bdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getBdoInDataObjectPackageIdMap() + .get("ID7"); // When dataObjectProfile is defined in SEDA 2.1 can't add - assertThatThrownBy(() -> - bdo.addMetadata(new StringType("DataObjectProfile", "Test"))).isInstanceOf(SEDALibException.class) - .hasMessageContaining("Impossible d'étendre le schéma"); + assertThatThrownBy(() -> bdo.addMetadata(new StringType("DataObjectProfile", "Test"))) + .isInstanceOf(SEDALibException.class) + .hasMessageContaining("Impossible d'étendre le schéma"); bdo.removeFirstNamedMetadata("DataObjectProfile"); // When test read write fragments in XML string format @@ -216,12 +228,13 @@ void testXMLFragment() throws SEDALibException, InterruptedException, FileNotFou String bdoNextOut = bdoNext.toSedaXmlFragments(); // Then - assertThat(bdoNextOut).isEqualToIgnoringWhitespace(ResourceUtils.getResourceAsString("import/binary_data_object_ID7.xml")); + assertThat(bdoNextOut).isEqualToIgnoringWhitespace( + ResourceUtils.getResourceAsString("import/binary_data_object_ID7.xml") + ); } @Test void testXMLFragmentForSedaVersion2() throws SEDALibException, InterruptedException, FileNotFoundException { - // Given SedaContext.setVersion(SedaVersion.V2_2); ObjectMapper mapper = new ObjectMapper(); @@ -232,10 +245,16 @@ void testXMLFragmentForSedaVersion2() throws SEDALibException, InterruptedExcept mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - BinaryDataObject bdo = si.getArchiveTransfer().getDataObjectPackage().getBdoInDataObjectPackageIdMap() - .get("ID7"); + BinaryDataObject bdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getBdoInDataObjectPackageIdMap() + .get("ID7"); bdo.addMetadata(new StringType("DataObjectProfile", "Test")); // When test read write fragments in XML string format @@ -245,13 +264,14 @@ void testXMLFragmentForSedaVersion2() throws SEDALibException, InterruptedExcept String bdoNextOut = bdoNext.toSedaXmlFragments(); // Then - assertThat(bdoNextOut).isEqualToIgnoringWhitespace(ResourceUtils.getResourceAsString("import/binary_data_object_ID7_seda2.2.xml")); + assertThat(bdoNextOut).isEqualToIgnoringWhitespace( + ResourceUtils.getResourceAsString("import/binary_data_object_ID7_seda2.2.xml") + ); SedaContext.setVersion(SedaVersion.V2_1); } @Test void testXMLFragmentForSedaVersion3() throws SEDALibException, InterruptedException, FileNotFoundException { - // Given SedaContext.setVersion(SedaVersion.V2_3); ObjectMapper mapper = new ObjectMapper(); @@ -262,14 +282,20 @@ void testXMLFragmentForSedaVersion3() throws SEDALibException, InterruptedExcept mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - BinaryDataObject bdo = si.getArchiveTransfer().getDataObjectPackage().getBdoInDataObjectPackageIdMap() - .get("ID7"); + BinaryDataObject bdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getBdoInDataObjectPackageIdMap() + .get("ID7"); bdo.addMetadata(new StringType("DataObjectProfile", "Test")); - bdo.addMetadata(new PersistentIdentifier("PType","POrigin", "PReference", "PContent")); - bdo.addMetadata(new StringType("DataObjectUse","BinaryMaster")); - bdo.addMetadata(new IntegerType("DataObjectNumber",1)); + bdo.addMetadata(new PersistentIdentifier("PType", "POrigin", "PReference", "PContent")); + bdo.addMetadata(new StringType("DataObjectUse", "BinaryMaster")); + bdo.addMetadata(new IntegerType("DataObjectNumber", 1)); // When test read write fragments in XML string format String bdoOut = bdo.toSedaXmlFragments(); @@ -278,7 +304,9 @@ void testXMLFragmentForSedaVersion3() throws SEDALibException, InterruptedExcept String bdoNextOut = bdoNext.toSedaXmlFragments(); // Then - assertThat(bdoNextOut).isEqualToIgnoringWhitespace(ResourceUtils.getResourceAsString("import/binary_data_object_ID7_seda2.3.xml")); + assertThat(bdoNextOut).isEqualToIgnoringWhitespace( + ResourceUtils.getResourceAsString("import/binary_data_object_ID7_seda2.3.xml") + ); SedaContext.setVersion(SedaVersion.V2_1); } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java index 414a1510..15a50379 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/DataObjectPackageTest.java @@ -60,25 +60,31 @@ class DataObjectPackageTest { void testCycleDetectionOK() throws SEDALibException, InterruptedException { // Given SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - SIPToArchiveTransferImporter wrongSi = new SIPToArchiveTransferImporter("src/test/resources/PacketSamples" + - "/TestSipCyclic.zip", "target/tmpJunit/TestSIPCyclic.zip-tmpdir" - , null); + SIPToArchiveTransferImporter wrongSi = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples" + "/TestSipCyclic.zip", + "target/tmpJunit/TestSIPCyclic.zip-tmpdir", + null + ); wrongSi.doImport(); // When test for acyclic si.getArchiveTransfer().getDataObjectPackage().verifyAcyclic(); - // Then ok } @Test void testCycleDetectionKO() throws SEDALibException, InterruptedException { // Given - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter("src/test/resources/PacketSamples" + - "/TestSipCyclic.zip", "target/tmpJunit/TestSipCyclic.zip-tmpdir" - , null); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples" + "/TestSipCyclic.zip", + "target/tmpJunit/TestSipCyclic.zip-tmpdir", + null + ); si.doImport(); // When test for acyclic, then KO @@ -90,7 +96,6 @@ void testCycleDetectionKO() throws SEDALibException, InterruptedException { @Test void testDogNormalisation() throws SEDALibException, InterruptedException, JsonProcessingException { - //Given ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); @@ -100,8 +105,10 @@ void testDogNormalisation() throws SEDALibException, InterruptedException, JsonP mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSipWrongDogReferences.zip", - "target/tmpJunit/TestSipWrongDogReferences.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSipWrongDogReferences.zip", + "target/tmpJunit/TestSipWrongDogReferences.zip-tmpdir", + null + ); si.doImport(); try { si.getArchiveTransfer().getDataObjectPackage().verifyDogUnicityCapacity(); @@ -111,15 +118,26 @@ void testDogNormalisation() throws SEDALibException, InterruptedException, JsonP assert (e.getMessage().contains("impossible sur l'ArchiveUnit [ID21]")); } - si = new SIPToArchiveTransferImporter("src/test/resources/PacketSamples/TestSipDogMerge.zip", - "target/tmpJunit/TestSipDogMerge.zip-tmpdir", null); + si = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples/TestSipDogMerge.zip", + "target/tmpJunit/TestSipDogMerge.zip-tmpdir", + null + ); si.doImport(); - String testau = "{\r\n" + " \"archiveUnitProfileXmlData\" : null,\r\n" + " \"managementXmlData\" : null,\r\n" - + " \"contentXmlData\" : \"\\n Item\\n 20160429_tuleap.pdf\\n Document \\\"20160429_tuleap.pdf\\\" joint au message <a8f34cc23a55bf2de3606d4e45609230@culture.gouv.fr>\\n \",\r\n" - + " \"childrenAuList\" : {\r\n" - + " \"inDataObjectPackageIdList\" : [ ]\r\n" + " },\r\n" + " \"dataObjectRefList\" : {\r\n" - + " \"inDataObjectPackageIdList\" : [ \"ID16\", \"ID22\", \"ID200\", \"ID201\" ]\r\n" + " },\r\n" - + " \"inDataObjectPackageId\" : \"ID21\",\r\n" + " \"onDiskPath\" : null\r\n" + "}"; + String testau = + "{\r\n" + + " \"archiveUnitProfileXmlData\" : null,\r\n" + + " \"managementXmlData\" : null,\r\n" + + " \"contentXmlData\" : \"\\n Item\\n 20160429_tuleap.pdf\\n Document \\\"20160429_tuleap.pdf\\\" joint au message <a8f34cc23a55bf2de3606d4e45609230@culture.gouv.fr>\\n \",\r\n" + + " \"childrenAuList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ ]\r\n" + + " },\r\n" + + " \"dataObjectRefList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ \"ID16\", \"ID22\", \"ID200\", \"ID201\" ]\r\n" + + " },\r\n" + + " \"inDataObjectPackageId\" : \"ID21\",\r\n" + + " \"onDiskPath\" : null\r\n" + + "}"; ArchiveUnit au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID21"); String sau = mapper.writeValueAsString(au); @@ -128,405 +146,409 @@ void testDogNormalisation() throws SEDALibException, InterruptedException, JsonP si.getArchiveTransfer().getDataObjectPackage().normalizeUniqDataObjectGroup(); testau = "{\r\n" + - " \"archiveUnitProfileXmlData\" : null,\r\n" + - " \"managementXmlData\" : null,\r\n" + - " \"contentXmlData\" : \"\\n Item\\n 20160429_tuleap.pdf\\n Document \\\"20160429_tuleap.pdf\\\" joint au message <a8f34cc23a55bf2de3606d4e45609230@culture.gouv.fr>\\n \",\r\n" + - " \"childrenAuList\" : {\r\n" + - " \"inDataObjectPackageIdList\" : [ ]\r\n" + - " },\r\n" + - " \"dataObjectRefList\" : {\r\n" + - " \"inDataObjectPackageIdList\" : [ \"ID52\" ]\r\n" + - " },\r\n" + - " \"inDataObjectPackageId\" : \"ID21\",\r\n" + - " \"onDiskPath\" : null\r\n" + - "}"; + " \"archiveUnitProfileXmlData\" : null,\r\n" + + " \"managementXmlData\" : null,\r\n" + + " \"contentXmlData\" : \"\\n Item\\n 20160429_tuleap.pdf\\n Document \\\"20160429_tuleap.pdf\\\" joint au message <a8f34cc23a55bf2de3606d4e45609230@culture.gouv.fr>\\n \",\r\n" + + " \"childrenAuList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ ]\r\n" + + " },\r\n" + + " \"dataObjectRefList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ \"ID52\" ]\r\n" + + " },\r\n" + + " \"inDataObjectPackageId\" : \"ID21\",\r\n" + + " \"onDiskPath\" : null\r\n" + + "}"; -// for (Map.Entry pair : si.getArchiveTransfer().getDataObjectPackage() -// .getAuInDataObjectPackageIdMap().entrySet()) { -// if (pair.getValue().contentXmlData.contains("20160429_tuleap.pdf")) { -// au = pair.getValue(); -// break; -// } -// } + // for (Map.Entry pair : si.getArchiveTransfer().getDataObjectPackage() + // .getAuInDataObjectPackageIdMap().entrySet()) { + // if (pair.getValue().contentXmlData.contains("20160429_tuleap.pdf")) { + // au = pair.getValue(); + // break; + // } + // } au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID21"); sau = mapper.writeValueAsString(au); -// System.out.println(sau); + // System.out.println(sau); assertThat(testau).isEqualToNormalizingNewlines(sau); System.err.println("La fusion des DOG a bien eue lieu"); - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID17.ods\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 50651\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"OpenDocument Spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/294\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID17\",\n" + - " \n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"TextContent_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID19.txt\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 3307\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Plain Text File\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"text/plain\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"x-fmt/111\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID19\",\n" + - " \n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID23.pdf\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"559dc14b4821f78aa138bb72923214c0f3635f0262f63999ba9c78d8df7833206f5e8310dedff60e9522c502ae3a5fe4e444c8e333efffac0f9c242b8f7a27f6\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 3868571\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Acrobat PDF 1.4 - Portable Document Format\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/pdf\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/18\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"20160429-tuleap.pdf\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID23\",\n" + - " \n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"TextContent_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID24.txt\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"14a0a17426b8b356f7769faede46fd09391689c5362939b8b5d8559fda5908b8579072cb802a87856f172401ded5f8bcf3c0315340da415b71e6f86deef72545\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 5104\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Plain Text File\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"text/plain\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"x-fmt/111\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"20160429-tuleap.pdf.txt\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID24\",\n" + - " \n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_2\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID200.json\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"3e8c7ca5f7f0a742b8f424639b81ed9c5d9c6296ad22e5fdb90cb908e04a36c51f698beb0045931e6df4001214f4f49f7b0d6b8ba4461c7a188da10ac5586839\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 120\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"JSON Data Interchange Format\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/json\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/817\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"SmallContract2.json\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID200\",\n" + - " \n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_3\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"content/ID201.json\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"3e8c7ca5f7f0a742b8f424639b81ed9c5d9c6296ad22e5fdb90cb908e04a36c51f698beb0045931e6df4001214f4f49f7b0d6b8ba4461c7a188da10ac5586839\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 120\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"JSON Data Interchange Format\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/json\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/817\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"SmallContract3.json\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID201\",\n" + - " \n" + - " } ],\n" + - " \"physicalDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"PhysicalMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"PhysicalId\",\n" + - " \"value\" : \"940 W\"\n" + - " }, {\n" + - " \"type\" : \"PhysicalDimensions\",\n" + - " \"elementName\" : \"PhysicalDimensions\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Width\",\n" + - " \"value\" : 10.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Height\",\n" + - " \"value\" : 8.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Depth\",\n" + - " \"value\" : 1.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Diameter\",\n" + - " \"value\" : 0.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"Weight\",\n" + - " \"elementName\" : \"Weight\",\n" + - " \"value\" : 59.0,\n" + - " \"unit\" : \"gram\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID18\",\n" + - " \"onDiskPath\" : null\n" + - " } ],\n" + - " \"logBook\" : {\n" + - " \"type\" : \"LogBook\",\n" + - " \"elementName\" : \"LogBook\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"Event\",\n" + - " \"elementName\" : \"Event\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"EventIdentifier\",\n" + - " \"value\" : \"event0001\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"EventDetail\",\n" + - " \"value\" : \"One event\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"Event\",\n" + - " \"elementName\" : \"Event\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"EventIdentifier\",\n" + - " \"value\" : \"event0002\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"EventDetail\",\n" + - " \"value\" : \"Two event\"\n" + - " } ]\n" + - " } ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID52\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - DataObjectGroup og = si.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap() - .get("ID52"); - System.out.println("Value to verify="+mapper.writeValueAsString(og)); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID17.ods\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 50651\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"OpenDocument Spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/294\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID17\",\n" + + " \n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"TextContent_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID19.txt\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 3307\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Plain Text File\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"text/plain\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"x-fmt/111\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID19\",\n" + + " \n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID23.pdf\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"559dc14b4821f78aa138bb72923214c0f3635f0262f63999ba9c78d8df7833206f5e8310dedff60e9522c502ae3a5fe4e444c8e333efffac0f9c242b8f7a27f6\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 3868571\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Acrobat PDF 1.4 - Portable Document Format\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/pdf\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/18\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"20160429-tuleap.pdf\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID23\",\n" + + " \n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"TextContent_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID24.txt\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"14a0a17426b8b356f7769faede46fd09391689c5362939b8b5d8559fda5908b8579072cb802a87856f172401ded5f8bcf3c0315340da415b71e6f86deef72545\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 5104\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Plain Text File\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"text/plain\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"x-fmt/111\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"20160429-tuleap.pdf.txt\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID24\",\n" + + " \n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_2\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID200.json\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"3e8c7ca5f7f0a742b8f424639b81ed9c5d9c6296ad22e5fdb90cb908e04a36c51f698beb0045931e6df4001214f4f49f7b0d6b8ba4461c7a188da10ac5586839\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 120\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"JSON Data Interchange Format\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/json\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/817\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"SmallContract2.json\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID200\",\n" + + " \n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_3\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"content/ID201.json\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"3e8c7ca5f7f0a742b8f424639b81ed9c5d9c6296ad22e5fdb90cb908e04a36c51f698beb0045931e6df4001214f4f49f7b0d6b8ba4461c7a188da10ac5586839\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 120\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"JSON Data Interchange Format\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/json\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/817\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"SmallContract3.json\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2018-08-28T19:22:19Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID201\",\n" + + " \n" + + " } ],\n" + + " \"physicalDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"PhysicalMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"PhysicalId\",\n" + + " \"value\" : \"940 W\"\n" + + " }, {\n" + + " \"type\" : \"PhysicalDimensions\",\n" + + " \"elementName\" : \"PhysicalDimensions\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Width\",\n" + + " \"value\" : 10.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Height\",\n" + + " \"value\" : 8.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Depth\",\n" + + " \"value\" : 1.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Diameter\",\n" + + " \"value\" : 0.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"Weight\",\n" + + " \"elementName\" : \"Weight\",\n" + + " \"value\" : 59.0,\n" + + " \"unit\" : \"gram\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID18\",\n" + + " \"onDiskPath\" : null\n" + + " } ],\n" + + " \"logBook\" : {\n" + + " \"type\" : \"LogBook\",\n" + + " \"elementName\" : \"LogBook\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"Event\",\n" + + " \"elementName\" : \"Event\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"EventIdentifier\",\n" + + " \"value\" : \"event0001\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"EventDetail\",\n" + + " \"value\" : \"One event\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"Event\",\n" + + " \"elementName\" : \"Event\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"EventIdentifier\",\n" + + " \"value\" : \"event0002\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"EventDetail\",\n" + + " \"value\" : \"Two event\"\n" + + " } ]\n" + + " } ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID52\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + DataObjectGroup og = si + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID52"); + System.out.println("Value to verify=" + mapper.writeValueAsString(og)); String sog = mapper.writeValueAsString(og); sog = sog.replaceAll("\"onDiskPath\" : .*\"", ""); @@ -546,24 +568,28 @@ void testRegenerateIds() throws SEDALibException, InterruptedException, JsonProc mapper.registerModule(module); mapper.enable(SerializationFeature.INDENT_OUTPUT); - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter("src/test/resources/PacketSamples/TestSip" + - ".zip", "target/tmpJunit/TestSip.zip-tmpdir", null); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples/TestSip" + ".zip", + "target/tmpJunit/TestSip.zip-tmpdir", + null + ); si.doImport(); si.getArchiveTransfer().getDataObjectPackage().regenerateContinuousIds(); - String testau = "{\r\n" + - " \"archiveUnitProfileXmlData\" : null,\r\n" + - " \"managementXmlData\" : null,\r\n" + - " \"contentXmlData\" : \"\\n Item\\n 3059_KO_agencies_HTML.csv\\n \",\r\n" + - " \"childrenAuList\" : {\r\n" + - " \"inDataObjectPackageIdList\" : [ ]\r\n" + - " },\r\n" + - " \"dataObjectRefList\" : {\r\n" + - " \"inDataObjectPackageIdList\" : [ \"ID46\" ]\r\n" + - " },\r\n" + - " \"inDataObjectPackageId\" : \"ID19\",\r\n" + - " \"onDiskPath\" : null\r\n" + - "}"; + String testau = + "{\r\n" + + " \"archiveUnitProfileXmlData\" : null,\r\n" + + " \"managementXmlData\" : null,\r\n" + + " \"contentXmlData\" : \"\\n Item\\n 3059_KO_agencies_HTML.csv\\n \",\r\n" + + " \"childrenAuList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ ]\r\n" + + " },\r\n" + + " \"dataObjectRefList\" : {\r\n" + + " \"inDataObjectPackageIdList\" : [ \"ID46\" ]\r\n" + + " },\r\n" + + " \"inDataObjectPackageId\" : \"ID19\",\r\n" + + " \"onDiskPath\" : null\r\n" + + "}"; ArchiveUnit au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID19"); String sau = mapper.writeValueAsString(au); diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java index 0f6a5bb4..15d3f43f 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/GlobalMetadataTest.java @@ -47,47 +47,47 @@ @ExtendWith(SedaContextExtension.class) class GlobalMetadataTest { - @Test - void test() throws SEDALibException { + @Test + void test() throws SEDALibException { + // Given + GlobalMetadata gm; + String gmFragments = + "Avec valeurs utilisables sur environnement de démo Vitam V2\n" + + "2018-09-15T01:38:56\n" + + "SIP SEDA de test V2\n" + + "ArchivalAgreement0\n" + + "\n" + + " ReplyCodeListVersion0\n" + + " MessageDigestAlgorithmCodeListVersion0\n" + + " MimeTypeCodeListVersion0\n" + + " EncodingCodeListVersion0\n" + + " FileFormatCodeListVersion0\n" + + " CompressionAlgorithmCodeListVersion0\n" + + " DataObjectVersionCodeListVersion0\n" + + " StorageRuleCodeListVersion0\n" + + " AppraisalRuleCodeListVersion0\n" + + " AccessRuleCodeListVersion0\n" + + " DisseminationRuleCodeListVersion0\n" + + " ReuseRuleCodeListVersion0\n" + + " ClassificationRuleCodeListVersion0\n" + + " AuthorizationReasonCodeListVersion0\n" + + " RelationshipCodeListVersion0\n" + + "\n" + + "Identifier3\n" + + "\n" + + " Identifier4\n" + + "\n" + + "\n" + + " Identifier5\n" + + ""; - // Given - GlobalMetadata gm; - String gmFragments = "Avec valeurs utilisables sur environnement de démo Vitam V2\n" + - "2018-09-15T01:38:56\n" + - "SIP SEDA de test V2\n" + - "ArchivalAgreement0\n" + - "\n" + - " ReplyCodeListVersion0\n" + - " MessageDigestAlgorithmCodeListVersion0\n" + - " MimeTypeCodeListVersion0\n" + - " EncodingCodeListVersion0\n" + - " FileFormatCodeListVersion0\n" + - " CompressionAlgorithmCodeListVersion0\n" + - " DataObjectVersionCodeListVersion0\n" + - " StorageRuleCodeListVersion0\n" + - " AppraisalRuleCodeListVersion0\n" + - " AccessRuleCodeListVersion0\n" + - " DisseminationRuleCodeListVersion0\n" + - " ReuseRuleCodeListVersion0\n" + - " ClassificationRuleCodeListVersion0\n" + - " AuthorizationReasonCodeListVersion0\n" + - " RelationshipCodeListVersion0\n" + - "\n" + - "Identifier3\n" + - "\n" + - " Identifier4\n" + - "\n" + - "\n" + - " Identifier5\n" + - ""; + gm = new GlobalMetadata(); - gm=new GlobalMetadata(); + // When test read write fragments in XML string format + gm.fromSedaXmlFragments(gmFragments); + String gmOut = gm.toSedaXmlFragments(); - // When test read write fragments in XML string format - gm.fromSedaXmlFragments(gmFragments); - String gmOut = gm.toSedaXmlFragments(); - - // Then - assertThat(gmOut).isEqualToNormalizingNewlines(gmFragments); - } + // Then + assertThat(gmOut).isEqualToNormalizingNewlines(gmFragments); + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java index 0f12c1d2..c0ea3084 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/PhysicalDataObjectTest.java @@ -60,7 +60,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @ExtendWith(SedaContextExtension.class) -@Execution(value = ExecutionMode.SAME_THREAD,reason= "Can't execute different SedaVersion treatment in parallel") +@Execution(value = ExecutionMode.SAME_THREAD, reason = "Can't execute different SedaVersion treatment in parallel") class PhysicalDataObjectTest { @Test @@ -74,10 +74,16 @@ void testJson() throws SEDALibException, InterruptedException, IOException { mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - PhysicalDataObject pdo = si.getArchiveTransfer().getDataObjectPackage().getPdoInDataObjectPackageIdMap() - .get("ID18"); + PhysicalDataObject pdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getPdoInDataObjectPackageIdMap() + .get("ID18"); String pdoOut = mapper.writeValueAsString(pdo); //System.out.println("Value to verify=" + pdoOut); @@ -87,72 +93,72 @@ void testJson() throws SEDALibException, InterruptedException, IOException { String pdoNextOut = mapper.writeValueAsString(pdoNext); // Then - String testOut = "{\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"PhysicalMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"PhysicalId\",\n" + - " \"value\" : \"940 W\"\n" + - " }, {\n" + - " \"type\" : \"PhysicalDimensions\",\n" + - " \"elementName\" : \"PhysicalDimensions\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Width\",\n" + - " \"value\" : 10.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Height\",\n" + - " \"value\" : 8.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Depth\",\n" + - " \"value\" : 1.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Diameter\",\n" + - " \"value\" : 0.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"Weight\",\n" + - " \"elementName\" : \"Weight\",\n" + - " \"value\" : 59.0,\n" + - " \"unit\" : \"gram\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Extent\",\n" + - " \"rawXml\" : \"1 carte imprimée\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Dimensions\",\n" + - " \"rawXml\" : \"10,5cm x 14,8cm\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Color\",\n" + - " \"rawXml\" : \"Noir et blanc\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Framing\",\n" + - " \"rawXml\" : \"Paysage\"\n" + - " }, {\n" + - " \"type\" : \"AnyXMLType\",\n" + - " \"elementName\" : \"Technique\",\n" + - " \"rawXml\" : \"Phototypie\"\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID18\",\n" + - " \"onDiskPath\" : null\n" + - "}"; + String testOut = + "{\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"PhysicalMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"PhysicalId\",\n" + + " \"value\" : \"940 W\"\n" + + " }, {\n" + + " \"type\" : \"PhysicalDimensions\",\n" + + " \"elementName\" : \"PhysicalDimensions\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Width\",\n" + + " \"value\" : 10.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Height\",\n" + + " \"value\" : 8.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Depth\",\n" + + " \"value\" : 1.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Diameter\",\n" + + " \"value\" : 0.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"Weight\",\n" + + " \"elementName\" : \"Weight\",\n" + + " \"value\" : 59.0,\n" + + " \"unit\" : \"gram\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Extent\",\n" + + " \"rawXml\" : \"1 carte imprimée\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Dimensions\",\n" + + " \"rawXml\" : \"10,5cm x 14,8cm\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Color\",\n" + + " \"rawXml\" : \"Noir et blanc\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Framing\",\n" + + " \"rawXml\" : \"Paysage\"\n" + + " }, {\n" + + " \"type\" : \"AnyXMLType\",\n" + + " \"elementName\" : \"Technique\",\n" + + " \"rawXml\" : \"Phototypie\"\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID18\",\n" + + " \"onDiskPath\" : null\n" + + "}"; testOut = testOut.replaceAll("\"onDiskPath\" : .*\"", ""); pdoNextOut = pdoNextOut.replaceAll("\"onDiskPath\" : .*\"", ""); assertThat(pdoNextOut).isEqualToNormalizingNewlines(testOut); - } @Test @@ -166,37 +172,43 @@ void testXMLFragment() throws SEDALibException, InterruptedException { mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); SedaContext.setVersion(SedaVersion.V2_1); si.doImport(); - PhysicalDataObject pdo = si.getArchiveTransfer().getDataObjectPackage().getPdoInDataObjectPackageIdMap() - .get("ID18"); + PhysicalDataObject pdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getPdoInDataObjectPackageIdMap() + .get("ID18"); // When dataObjectProfile defined in SEDA 2.1 it's at the end as an extension pdo.addSedaXmlFragments("Test"); String pdoOut = pdo.toSedaXmlFragments(); // Then - String testOut1 = " PhysicalMaster_1\n" + - " 940 W\n" + - " \n" + - " 10.0\n" + - " 8.0\n" + - " 1.0\n" + - " 0.0\n" + - " 59.0\n" + - " \n" + - " 1 carte imprimée\n" + - " 10,5cm x 14,8cm\n" + - " Noir et blanc\n" + - " Paysage\n" + - " Phototypie\n" + - " Test"; + String testOut1 = + " PhysicalMaster_1\n" + + " 940 W\n" + + " \n" + + " 10.0\n" + + " 8.0\n" + + " 1.0\n" + + " 0.0\n" + + " 59.0\n" + + " \n" + + " 1 carte imprimée\n" + + " 10,5cm x 14,8cm\n" + + " Noir et blanc\n" + + " Paysage\n" + + " Phototypie\n" + + " Test"; assertThat(pdoOut).isEqualToNormalizingNewlines(testOut1); pdo.removeFirstNamedMetadata("DataObjectProfile"); - // When test read write fragments in XML string format pdoOut = pdo.toSedaXmlFragments(); PhysicalDataObject pdoNext = new PhysicalDataObject(si.getArchiveTransfer().getDataObjectPackage()); @@ -204,20 +216,21 @@ void testXMLFragment() throws SEDALibException, InterruptedException { String pdoNextOut = pdoNext.toSedaXmlFragments(); // Then - String testOut2 = " PhysicalMaster_1\n" + - " 940 W\n" + - " \n" + - " 10.0\n" + - " 8.0\n" + - " 1.0\n" + - " 0.0\n" + - " 59.0\n" + - " \n" + - " 1 carte imprimée\n" + - " 10,5cm x 14,8cm\n" + - " Noir et blanc\n" + - " Paysage\n" + - " Phototypie"; + String testOut2 = + " PhysicalMaster_1\n" + + " 940 W\n" + + " \n" + + " 10.0\n" + + " 8.0\n" + + " 1.0\n" + + " 0.0\n" + + " 59.0\n" + + " \n" + + " 1 carte imprimée\n" + + " 10,5cm x 14,8cm\n" + + " Noir et blanc\n" + + " Paysage\n" + + " Phototypie"; assertThat(pdoNextOut).isEqualToNormalizingNewlines(testOut2); } @@ -233,10 +246,16 @@ void testXMLFragmentForSedaVersion2() throws SEDALibException, InterruptedExcept mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - PhysicalDataObject pdo = si.getArchiveTransfer().getDataObjectPackage().getPdoInDataObjectPackageIdMap() - .get("ID18"); + PhysicalDataObject pdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getPdoInDataObjectPackageIdMap() + .get("ID18"); pdo.addNewMetadata("DataObjectProfile", "Test"); // When test read write fragments in XML string format @@ -246,21 +265,22 @@ void testXMLFragmentForSedaVersion2() throws SEDALibException, InterruptedExcept String pdoNextOut = pdoNext.toSedaXmlFragments(); // Then - String testOut = " Test\n" + - " PhysicalMaster_1\n" + - " 940 W\n" + - " \n" + - " 10.0\n" + - " 8.0\n" + - " 1.0\n" + - " 0.0\n" + - " 59.0\n" + - " \n" + - " 1 carte imprimée\n" + - " 10,5cm x 14,8cm\n" + - " Noir et blanc\n" + - " Paysage\n" + - " Phototypie"; + String testOut = + " Test\n" + + " PhysicalMaster_1\n" + + " 940 W\n" + + " \n" + + " 10.0\n" + + " 8.0\n" + + " 1.0\n" + + " 0.0\n" + + " 59.0\n" + + " \n" + + " 1 carte imprimée\n" + + " 10,5cm x 14,8cm\n" + + " Noir et blanc\n" + + " Paysage\n" + + " Phototypie"; assertThat(pdoNextOut).isEqualToNormalizingNewlines(testOut); SedaContext.setVersion(SedaVersion.V2_1); } @@ -277,10 +297,16 @@ void testXMLFragmentForSedaVersion3() throws SEDALibException, InterruptedExcept mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSip.zip", "target/tmpJunit/TestSIP.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSip.zip", + "target/tmpJunit/TestSIP.zip-tmpdir", + null + ); si.doImport(); - PhysicalDataObject pdo = si.getArchiveTransfer().getDataObjectPackage().getPdoInDataObjectPackageIdMap() - .get("ID18"); + PhysicalDataObject pdo = si + .getArchiveTransfer() + .getDataObjectPackage() + .getPdoInDataObjectPackageIdMap() + .get("ID18"); pdo.addNewMetadata("DataObjectProfile", "Test"); pdo.addMetadata(new PersistentIdentifier("PType", "POrigin", "PReference", "PContent")); pdo.addMetadata(new StringType("DataObjectUse", "PhysicalMaster")); @@ -293,29 +319,30 @@ void testXMLFragmentForSedaVersion3() throws SEDALibException, InterruptedExcept String pdoNextOut = pdoNext.toSedaXmlFragments(); // Then - String testOut = " Test\n" + - " PhysicalMaster_1\n" + - " \n" + - " PType\n" + - " POrigin\n" + - " PReference\n" + - " PContent\n" + - " \n" + - " PhysicalMaster\n" + - " 1\n" + - " 940 W\n" + - " \n" + - " 10.0\n" + - " 8.0\n" + - " 1.0\n" + - " 0.0\n" + - " 59.0\n" + - " \n" + - " 1 carte imprimée\n" + - " 10,5cm x 14,8cm\n" + - " Noir et blanc\n" + - " Paysage\n" + - " Phototypie"; + String testOut = + " Test\n" + + " PhysicalMaster_1\n" + + " \n" + + " PType\n" + + " POrigin\n" + + " PReference\n" + + " PContent\n" + + " \n" + + " PhysicalMaster\n" + + " 1\n" + + " 940 W\n" + + " \n" + + " 10.0\n" + + " 8.0\n" + + " 1.0\n" + + " 0.0\n" + + " 59.0\n" + + " \n" + + " 1 carte imprimée\n" + + " 10,5cm x 14,8cm\n" + + " Noir et blanc\n" + + " Paysage\n" + + " Phototypie"; assertThat(pdoNextOut).isEqualToNormalizingNewlines(testOut); SedaContext.setVersion(SedaVersion.V2_1); } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java index 73316608..683ada34 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/SEDA2VersionTest.java @@ -60,24 +60,25 @@ class SEDA2VersionTest { @Test - // Test the SEDA2.1 and 2.2 construct from xml string (fromSedaXML) + // Test the SEDA2.1 and 2.2 construct from xml string (fromSedaXML) void testSeda2VersionComplianceTest() throws SEDALibException { // Given SedaContext.setVersion(SedaVersion.V2_1); Content c = new Content(); - String xmlFragments=" \n" + - " AUT-234452\n" + - " Autorisation\n" + - " 2104-05-31T01:00:00\n" + - " OK\n" + - " OK\n" + - " \n" + - " Matricule\n" + - " 123456789\n" + - " Archiviste\n" + - " \n" + - " \n"; + String xmlFragments = + " \n" + + " AUT-234452\n" + + " Autorisation\n" + + " 2104-05-31T01:00:00\n" + + " OK\n" + + " OK\n" + + " \n" + + " Matricule\n" + + " 123456789\n" + + " Archiviste\n" + + " \n" + + " \n"; c.addSedaXmlFragments(xmlFragments); // Test XML export depending on Seda2 version @@ -86,9 +87,7 @@ void testSeda2VersionComplianceTest() throws SEDALibException { // Then in Seda2.1 version the LinkingAgentIdentifier is in expansion field and order is kept the same - String testOut = "\n" + - xmlFragments + - ""; + String testOut = "\n" + xmlFragments + ""; assertThat(cOut).isEqualTo(testOut); // But in Seda2.2 version the LinkingAgentIdentifier is a recognized XML element and re-ordered before the @@ -102,57 +101,60 @@ void testSeda2VersionComplianceTest() throws SEDALibException { } @Test - // Test the SEDA2.1 to and from 2.2 conversion + // Test the SEDA2.1 to and from 2.2 conversion void testSeda2VersionConversionTest() throws SEDALibException { // Given SedaContext.setVersion(SedaVersion.V2_1); - String xmlFragments=" \n" + - " \n" + - " \n" + - " \n" + - " RecordGrp\n" + - " Nouvelle ArchiveUnit\n" + - " Ce test est pour voir ce qui se passe\n" + - " après 20 espaces\n" + - " \n" + - " TyE\n" + - " 2022-05-10T00:00:00.000\n" + - " DetE\n" + - " \n" + - " ty\n" + - " va\n" + - " ro\n" + - " \n" + - " 123\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " Acquisition Information\n" + - " Public Archive\n" + - " Service_producteur\n" + - " Service_versant\n" + - " \n" + - " "; + String xmlFragments = + " \n" + + " \n" + + " \n" + + " \n" + + " RecordGrp\n" + + " Nouvelle ArchiveUnit\n" + + " Ce test est pour voir ce qui se passe\n" + + " après 20 espaces\n" + + " \n" + + " TyE\n" + + " 2022-05-10T00:00:00.000\n" + + " DetE\n" + + " \n" + + " ty\n" + + " va\n" + + " ro\n" + + " \n" + + " 123\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " Acquisition Information\n" + + " Public Archive\n" + + " Service_producteur\n" + + " Service_versant\n" + + " \n" + + " "; // Test the import in Seda2.1 - DataObjectPackage dop=null; - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlFragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais)) { + DataObjectPackage dop = null; + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlFragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais) + ) { xmlReader.nextUsefullEvent(); - dop=DataObjectPackage.fromSedaXml(xmlReader, "", null); + dop = DataObjectPackage.fromSedaXml(xmlReader, "", null); } catch (XMLStreamException | IOException | InterruptedException e) { assertThat(e).isNull(); } - Content c=dop.getArchiveUnitById("ID10").getContent(); - boolean foundLinking=false; + Content c = dop.getArchiveUnitById("ID10").getContent(); + boolean foundLinking = false; for (SEDAMetadata sm : c.getMetadataList()) { - if (sm.getXmlElementName().equals("Event")){ - Event event=(Event) sm; - for (SEDAMetadata osm : event.getMetadataList()){ + if (sm.getXmlElementName().equals("Event")) { + Event event = (Event) sm; + for (SEDAMetadata osm : event.getMetadataList()) { if (osm instanceof LinkingAgentIdentifier) { foundLinking = true; break; @@ -162,21 +164,19 @@ void testSeda2VersionConversionTest() throws SEDALibException { } assertThat(foundLinking).isFalse(); - // Then the Event in ArchiveUnit has a LinkingAgentIdentifierType metadata try { - dop= new SedaVersionConverter(null).convert(dop, SedaVersion.V2_1, SedaVersion.V2_2); - } catch (InterruptedException ignored) { - } + dop = new SedaVersionConverter(null).convert(dop, SedaVersion.V2_1, SedaVersion.V2_2); + } catch (InterruptedException ignored) {} SedaContext.setVersion(SedaVersion.V2_2); - c=dop.getArchiveUnitById("ID10").getContent(); - foundLinking=false; + c = dop.getArchiveUnitById("ID10").getContent(); + foundLinking = false; for (SEDAMetadata sm : c.getMetadataList()) { - if (sm.getXmlElementName().equals("Event")){ - Event event=(Event) sm; - for (SEDAMetadata osm : event.getMetadataList()){ + if (sm.getXmlElementName().equals("Event")) { + Event event = (Event) sm; + for (SEDAMetadata osm : event.getMetadataList()) { if (osm instanceof LinkingAgentIdentifier) { foundLinking = true; break; diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java index be8b989b..f528a111 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/json/ArchiveTransferSerDeserializerTest.java @@ -58,57 +58,58 @@ @ExtendWith(SedaContextExtension.class) class ArchiveTransferSerDeserializerTest implements UseTestFiles { - @Test - void TestSipSerializationDeserialization() - throws SEDALibException, IOException, InterruptedException { - // do import of test directory - DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples" + - "/SampleWithoutLinksModelV1", null); - di.addIgnorePattern("Thumbs.db"); - di.addIgnorePattern("pagefile.sys"); - di.doImport(); + @Test + void TestSipSerializationDeserialization() throws SEDALibException, IOException, InterruptedException { + // do import of test directory + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples" + "/SampleWithoutLinksModelV1", + null + ); + di.addIgnorePattern("Thumbs.db"); + di.addIgnorePattern("pagefile.sys"); + di.doImport(); - // assert macro results - assertEquals(22,di.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); - assertEquals(11,di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); + // assert macro results + assertEquals(22, di.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); + assertEquals(11, di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); - // create jackson object mapper - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + // create jackson object mapper + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - // assert archiveTransfer serialization/deserialization - String ssip = mapper.writeValueAsString(di.getArchiveTransfer()); - ArchiveTransfer dssip = mapper.readValue(ssip, ArchiveTransfer.class); - String sdssip = mapper.writeValueAsString(dssip); -// mapper.writeValue(new FileOutputStream("target/tmpJunit/junit_sip.json"), di.getArchiveTransfer()); -// mapper.writeValue(new FileOutputStream("target/tmpJunit/junit_sip_after.json"), dssip); - assertEquals(ssip, sdssip); + // assert archiveTransfer serialization/deserialization + String ssip = mapper.writeValueAsString(di.getArchiveTransfer()); + ArchiveTransfer dssip = mapper.readValue(ssip, ArchiveTransfer.class); + String sdssip = mapper.writeValueAsString(dssip); + // mapper.writeValue(new FileOutputStream("target/tmpJunit/junit_sip.json"), di.getArchiveTransfer()); + // mapper.writeValue(new FileOutputStream("target/tmpJunit/junit_sip_after.json"), dssip); + assertEquals(ssip, sdssip); + } - } + @Test + void TestDeserializationKO() throws SEDALibException, IOException, InterruptedException { + // create jackson object mapper + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - @Test - void TestDeserializationKO() - throws SEDALibException, IOException, InterruptedException { + // assert archiveTransfer serialization/deserialization + assertThatThrownBy(() -> mapper.readValue("{Toto}", ArchiveTransfer.class)).hasMessageContaining( + "Unexpected character" + ); + } - // create jackson object mapper - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - // assert archiveTransfer serialization/deserialization - assertThatThrownBy(() -> mapper.readValue("{Toto}", ArchiveTransfer.class)) - .hasMessageContaining("Unexpected character"); - } - - @Test - void TestSEDALibJsonProcessingException(){ - assertThatThrownBy(()->{throw new SEDALibJsonProcessingException("Test it");}).hasMessage("Test it"); - } + @Test + void TestSEDALibJsonProcessingException() { + assertThatThrownBy(() -> { + throw new SEDALibJsonProcessingException("Test it"); + }).hasMessage("Test it"); + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java index 369b7679..192f44c2 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionConverterTest.java @@ -50,13 +50,13 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; + import static org.assertj.core.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; -import java.io.ByteArrayInputStream; -import java.nio.charset.StandardCharsets; - @ExtendWith(SedaContextExtension.class) public class SedaVersionConverterTest { @@ -103,9 +103,10 @@ public void testConvert_successful() throws Exception { ""; DataObjectPackage dop; - try (ByteArrayInputStream bais = new ByteArrayInputStream(xmlFragments.getBytes(StandardCharsets.UTF_8)); - SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais)) { - + try ( + ByteArrayInputStream bais = new ByteArrayInputStream(xmlFragments.getBytes(StandardCharsets.UTF_8)); + SEDAXMLEventReader xmlReader = new SEDAXMLEventReader(bais) + ) { xmlReader.nextUsefullEvent(); // skip StartDocument dop = DataObjectPackage.fromSedaXml(xmlReader, "", logger); } @@ -131,9 +132,7 @@ public void testConvert_successful() throws Exception { } } - assertThat(foundLinking) - .as("LinkingAgentIdentifierType should be present after conversion") - .isTrue(); + assertThat(foundLinking).as("LinkingAgentIdentifierType should be present after conversion").isTrue(); } @Test @@ -172,4 +171,4 @@ public void shouldFailWhenSourceVersionAndContextVersionAreDifferent() { assertTrue(thrown.getMessage().contains("different")); } -} \ No newline at end of file +} diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java index 216de89e..cd187166 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/core/seda/SedaVersionTest.java @@ -61,16 +61,17 @@ void shouldParseMajorMinorVersions() { @Test void shouldThrowExceptionForUnsupportedMinorOnlyVersion() { - IllegalArgumentException exception = - assertThrows(IllegalArgumentException.class, () -> SedaVersion.from("4")); + IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> SedaVersion.from("4")); assertEquals("Unsupported SEDA version: 2.4", exception.getMessage()); } @Test void shouldThrowExceptionForUnsupportedMajorMinorVersion() { - IllegalArgumentException exception = - assertThrows(IllegalArgumentException.class, () -> SedaVersion.from("3.0")); + IllegalArgumentException exception = assertThrows( + IllegalArgumentException.class, + () -> SedaVersion.from("3.0") + ); assertEquals("Unsupported SEDA version: 3.0", exception.getMessage()); } @@ -81,4 +82,4 @@ void shouldThrowExceptionForInvalidFormat() { assertThrows(NumberFormatException.class, () -> SedaVersion.from("a")); assertThrows(NumberFormatException.class, () -> SedaVersion.from("2.a")); } -} \ No newline at end of file +} diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java index 4938b589..89b90f01 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveDeliveryRequestReplyFromXmlTest.java @@ -56,81 +56,88 @@ @ExtendWith(SedaContextExtension.class) class ArchiveDeliveryRequestReplyFromXmlTest { - @Test - void test() throws SEDALibException, InterruptedException, JsonProcessingException { - // create jackson object mapper - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + @Test + void test() throws SEDALibException, InterruptedException, JsonProcessingException { + // create jackson object mapper + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - DIPToArchiveDeliveryRequestReplyImporter si = new DIPToArchiveDeliveryRequestReplyImporter( - "src/test/resources/PacketSamples/TestDIP.zip", "target/tmpJunit/TestDIP.zip-tmpdir", null); - si.doImport(); - - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"Content/aeaaaaaaaahph73oaa4eealgbuxxariaaaaq.pdf\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"70ed5a707d8e7f421f7821131d40878de6d081d6961a0237dc7e1d18187d891fcc36abeeeed5b58a2caf249b1300d83b6bfd19afc462db3e4b152cf86bea545e\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 33553\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Acrobat PDF/A - Portable Document Format\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/pdf\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/354\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"009734_20130456_0001_20120117_DI_AN_CMP_lecture_retraite_magistrats.pdf.pdf\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2012-10-22T11:27:14Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"aeaaaaaaaahph73oaa4eealgbuxxariaaaaq\",\n" + - " \n" + - " } ],\n" + - " \"physicalDataObjectList\" : [ ],\n" + - " \"logBook\" : null,\n" + - " \"inDataObjectPackageId\" : \"aebaaaaaa4hph73oaa4eealgbuxxariaaaba\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - DataObjectGroup og = si.getArchiveDeliveryRequestReply().getDataObjectPackage().getDogInDataObjectPackageIdMap().get("aebaaaaaa4hph73oaa4eealgbuxxariaaaba"); - String sog = mapper.writeValueAsString(og); - sog = sog.replaceAll("\"onDiskPath\" : .*\"", ""); - testog = testog.replaceAll("\"onDiskPath\" : .*\"", ""); - assertThat(sog).isEqualToNormalizingNewlines(testog); - } + DIPToArchiveDeliveryRequestReplyImporter si = new DIPToArchiveDeliveryRequestReplyImporter( + "src/test/resources/PacketSamples/TestDIP.zip", + "target/tmpJunit/TestDIP.zip-tmpdir", + null + ); + si.doImport(); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"Content/aeaaaaaaaahph73oaa4eealgbuxxariaaaaq.pdf\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"70ed5a707d8e7f421f7821131d40878de6d081d6961a0237dc7e1d18187d891fcc36abeeeed5b58a2caf249b1300d83b6bfd19afc462db3e4b152cf86bea545e\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 33553\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Acrobat PDF/A - Portable Document Format\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/pdf\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/354\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"009734_20130456_0001_20120117_DI_AN_CMP_lecture_retraite_magistrats.pdf.pdf\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2012-10-22T11:27:14Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"aeaaaaaaaahph73oaa4eealgbuxxariaaaaq\",\n" + + " \n" + + " } ],\n" + + " \"physicalDataObjectList\" : [ ],\n" + + " \"logBook\" : null,\n" + + " \"inDataObjectPackageId\" : \"aebaaaaaa4hph73oaa4eealgbuxxariaaaba\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + DataObjectGroup og = si + .getArchiveDeliveryRequestReply() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("aebaaaaaa4hph73oaa4eealgbuxxariaaaba"); + String sog = mapper.writeValueAsString(og); + sog = sog.replaceAll("\"onDiskPath\" : .*\"", ""); + testog = testog.replaceAll("\"onDiskPath\" : .*\"", ""); + assertThat(sog).isEqualToNormalizingNewlines(testog); + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java index cea2a78d..ba4149d9 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/ArchiveTransferToFromXmlTest.java @@ -65,11 +65,12 @@ private static String readFileToString(String path) throws IOException { @Test void testToFromSedaXml() - throws IllegalArgumentException, SEDALibException, XMLStreamException, IOException, InterruptedException { - + throws IllegalArgumentException, SEDALibException, XMLStreamException, IOException, InterruptedException { // do import of test directory DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithLinksModelV2", null); + "src/test/resources/PacketSamples/SampleWithLinksModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -79,30 +80,34 @@ void testToFromSedaXml() di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; - di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" - + " ReplyCodeListVersion0\n" - + "MessageDigestAlgorithmCodeListVersion0\n" - + "MimeTypeCodeListVersion0\n" - + "EncodingCodeListVersion0\n" - + "FileFormatCodeListVersion0\n" - + "CompressionAlgorithmCodeListVersion0\n" - + "DataObjectVersionCodeListVersion0\n" - + "StorageRuleCodeListVersion0\n" - + "AppraisalRuleCodeListVersion0\n" - + "AccessRuleCodeListVersion0\n" - + "DisseminationRuleCodeListVersion0\n" - + "ReuseRuleCodeListVersion0\n" - + "ClassificationRuleCodeListVersion0\n" - + "AuthorizationReasonCodeListVersion0\n" - + "RelationshipCodeListVersion0\n" - + " "; - di.getArchiveTransfer().getDataObjectPackage() - .setManagementMetadataXmlData("\n" - + " Acquisition Information\n" - + "Public Archive\n" - + "Service_producteur\n" - + "Service_versant\n" - + " "); + di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" + + " ReplyCodeListVersion0\n" + + "MessageDigestAlgorithmCodeListVersion0\n" + + "MimeTypeCodeListVersion0\n" + + "EncodingCodeListVersion0\n" + + "FileFormatCodeListVersion0\n" + + "CompressionAlgorithmCodeListVersion0\n" + + "DataObjectVersionCodeListVersion0\n" + + "StorageRuleCodeListVersion0\n" + + "AppraisalRuleCodeListVersion0\n" + + "AccessRuleCodeListVersion0\n" + + "DisseminationRuleCodeListVersion0\n" + + "ReuseRuleCodeListVersion0\n" + + "ClassificationRuleCodeListVersion0\n" + + "AuthorizationReasonCodeListVersion0\n" + + "RelationshipCodeListVersion0\n" + + " "; + di + .getArchiveTransfer() + .getDataObjectPackage() + .setManagementMetadataXmlData( + "\n" + + " Acquisition Information\n" + + "Public Archive\n" + + "Service_producteur\n" + + "Service_versant\n" + + " " + ); di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; @@ -111,26 +116,31 @@ void testToFromSedaXml() SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2); di.getArchiveTransfer().toSedaXml(xmlWriter, false, null); xmlWriter.close(); - String generatedFlatManifest = baos.toString(StandardCharsets.UTF_8).replaceAll(".*\n", ""); + String generatedFlatManifest = baos + .toString(StandardCharsets.UTF_8) + .replaceAll(".*\n", ""); // hierarchical baos.reset(); xmlWriter = new SEDAXMLStreamWriter(baos, 2); di.getArchiveTransfer().toSedaXml(xmlWriter, true, null); xmlWriter.close(); - String generatedHierarchicalManifest = baos.toString(StandardCharsets.UTF_8).replaceAll(".*\n", ""); + String generatedHierarchicalManifest = baos + .toString(StandardCharsets.UTF_8) + .replaceAll(".*\n", ""); String fileManifest = readFileToString("src/test/resources/PacketSamples/SampleWithLinkFlatManifest.xml"); generatedFlatManifest = generatedFlatManifest.substring(generatedFlatManifest.indexOf("MessageIdentifier")); fileManifest = fileManifest.substring(fileManifest.indexOf("MessageIdentifier")); -//WARNING: if Git is not set to respect LF this test will fail + //WARNING: if Git is not set to respect LF this test will fail assertThat(generatedFlatManifest).isEqualToNormalizingNewlines(fileManifest); fileManifest = readFileToString("src/test/resources/PacketSamples/SampleWithLinkHierarchicalManifest.xml"); - generatedHierarchicalManifest = generatedHierarchicalManifest - .substring(generatedHierarchicalManifest.indexOf("MessageIdentifier")); + generatedHierarchicalManifest = generatedHierarchicalManifest.substring( + generatedHierarchicalManifest.indexOf("MessageIdentifier") + ); fileManifest = fileManifest.substring(fileManifest.indexOf("MessageIdentifier")); -//WARNING: if Git is not set to respect LF this test will fail - assertThat(generatedHierarchicalManifest).isEqualToNormalizingNewlines(fileManifest); + //WARNING: if Git is not set to respect LF this test will fail + assertThat(generatedHierarchicalManifest).isEqualToNormalizingNewlines(fileManifest); } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java index 65ca09ae..02956413 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataExporterTest.java @@ -71,19 +71,20 @@ private static boolean isLink(Path path) { try { if (Files.isSymbolicLink(path)) { return true; - } else if (TestUtilities.isWindowsOS() && Files.isRegularFile(path) - && path.getFileName().toString().toLowerCase().endsWith(".lnk")) { + } else if ( + TestUtilities.isWindowsOS() && + Files.isRegularFile(path) && + path.getFileName().toString().toLowerCase().endsWith(".lnk") + ) { WindowsShortcut ws = new WindowsShortcut(path.toFile()); return true; } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} return false; } private static boolean compareTwoPathString(Path pathA, Path pathB) { - if (Files.isDirectory(pathA) && Files.isDirectory(pathB)) - return true; + if (Files.isDirectory(pathA) && Files.isDirectory(pathB)) return true; else if (Files.isSymbolicLink(pathA) && Files.isSymbolicLink(pathB)) { try { if (!Files.readSymbolicLink(pathA).equals(Files.readSymbolicLink(pathB))) { @@ -166,19 +167,16 @@ private void unzip(String zipFile, String extractFolder) { // create the parent directory structure if needed destinationParent.mkdirs(); - if (entry.isDirectory()) - destFile.mkdirs(); + if (entry.isDirectory()) destFile.mkdirs(); else { - BufferedInputStream is = new BufferedInputStream(zip - .getInputStream(entry)); + BufferedInputStream is = new BufferedInputStream(zip.getInputStream(entry)); int currentByte; // establish buffer for writing file byte[] data = new byte[BUFFER]; // write the current file to disk FileOutputStream fos = new FileOutputStream(destFile); - BufferedOutputStream dest = new BufferedOutputStream(fos, - BUFFER); + BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); // read and write until last byte is encountered while ((currentByte = is.read(data, 0, BUFFER)) != -1) { @@ -188,8 +186,6 @@ private void unzip(String zipFile, String extractFolder) { dest.close(); is.close(); } - - } } catch (Exception e) { System.err.println("Can't unzip " + e.getMessage()); @@ -200,7 +196,10 @@ private void unzip(String zipFile, String extractFolder) { void exportDiskOK() throws SEDALibException, InterruptedException, IOException { // do import of test directory DiskToArchiveTransferImporter di; - di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", null); + di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -210,21 +209,39 @@ void exportDiskOK() throws SEDALibException, InterruptedException, IOException { // When loaded with the csv OK test file eraseAll("target/tmpJunit/CSVMetadataExporterDisk"); - cme = new DataObjectPackageToCSVMetadataExporter(di.getArchiveTransfer().getDataObjectPackage(), "UTF8", ';', ALL_DATAOBJECTS, false, 0, null); + cme = new DataObjectPackageToCSVMetadataExporter( + di.getArchiveTransfer().getDataObjectPackage(), + "UTF8", + ';', + ALL_DATAOBJECTS, + false, + 0, + null + ); cme.doExportToCSVDiskHierarchy("target/tmpJunit/CSVMetadataExporterDisk", "metadata.csv"); - unzip("src/test/resources/ExpectedResults/ExportedMetadata.zip", "target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"); + unzip( + "src/test/resources/ExpectedResults/ExportedMetadata.zip", + "target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip" + ); // Then exported directory is equivalent to imported one - assertThat(compareDirectories(Paths.get("target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"), - Paths.get("target/tmpJunit/CSVMetadataExporterDisk"))).isTrue(); + assertThat( + compareDirectories( + Paths.get("target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"), + Paths.get("target/tmpJunit/CSVMetadataExporterDisk") + ) + ).isTrue(); } @Test void exportCSVOK() throws SEDALibException, InterruptedException, IOException { // do import of test directory DiskToArchiveTransferImporter di; - di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", null); + di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -234,11 +251,21 @@ void exportCSVOK() throws SEDALibException, InterruptedException, IOException { // When loaded with the csv OK test file eraseAll("target/tmpJunit/CSVMetadataExporterCSV"); - csvMetadataExporter = new DataObjectPackageToCSVMetadataExporter(di.getArchiveTransfer().getDataObjectPackage(), "UTF8", ';', ALL_DATAOBJECTS, false, 0, null); + csvMetadataExporter = new DataObjectPackageToCSVMetadataExporter( + di.getArchiveTransfer().getDataObjectPackage(), + "UTF8", + ';', + ALL_DATAOBJECTS, + false, + 0, + null + ); csvMetadataExporter.doExportToCSVMetadataFile(TEMPORARY_FILE); // Then verify that csv content is the expected content, except for the system dependant file separator and new lines - String generatedFileContent = TestUtilities.SlackNormalize(FileUtils.readFileToString(new File(TEMPORARY_FILE), "UTF8")); + String generatedFileContent = TestUtilities.SlackNormalize( + FileUtils.readFileToString(new File(TEMPORARY_FILE), "UTF8") + ); String expectedFileContent = ResourceUtils.getResourceAsString("ExpectedResults/ExportedMetadata.csv"); assertThat(generatedFileContent).isEqualToNormalizingNewlines(expectedFileContent); @@ -248,7 +275,10 @@ void exportCSVOK() throws SEDALibException, InterruptedException, IOException { void exportCSVWithExtendedFormat() throws SEDALibException, InterruptedException, IOException { // do import of test directory DiskToArchiveTransferImporter di; - di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", null); + di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -258,12 +288,24 @@ void exportCSVWithExtendedFormat() throws SEDALibException, InterruptedException // When loaded with the csv OK test file eraseAll("target/tmpJunit/CSVMetadataExporterCSV"); - cme = new DataObjectPackageToCSVMetadataExporter(di.getArchiveTransfer().getDataObjectPackage(), "UTF8", ';', ALL_DATAOBJECTS, true, 0, null); + cme = new DataObjectPackageToCSVMetadataExporter( + di.getArchiveTransfer().getDataObjectPackage(), + "UTF8", + ';', + ALL_DATAOBJECTS, + true, + 0, + null + ); cme.doExportToCSVMetadataFile(TEMPORARY_FILE); // Then verify that csv content is the expected content, except for the system dependant file separator and new lines - String generatedFileContent = TestUtilities.SlackNormalize(FileUtils.readFileToString(new File(TEMPORARY_FILE), "UTF8")); - String expectedFileContent = ResourceUtils.getResourceAsString("ExpectedResults/ExportedMetadataWithExtendedFormat.csv"); + String generatedFileContent = TestUtilities.SlackNormalize( + FileUtils.readFileToString(new File(TEMPORARY_FILE), "UTF8") + ); + String expectedFileContent = ResourceUtils.getResourceAsString( + "ExpectedResults/ExportedMetadataWithExtendedFormat.csv" + ); assertThat(generatedFileContent).isEqualToNormalizingNewlines(expectedFileContent); } @@ -271,7 +313,10 @@ void exportCSVWithExtendedFormat() throws SEDALibException, InterruptedException void exportZipOK() throws SEDALibException, InterruptedException, IOException { // do import of test directory DiskToArchiveTransferImporter di; - di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", null); + di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithTitleDirectoryNameModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -281,15 +326,32 @@ void exportZipOK() throws SEDALibException, InterruptedException, IOException { // When loaded with the csv OK test file eraseAll("target/tmpJunit/CSVMetadataExporterZIP"); - cme = new DataObjectPackageToCSVMetadataExporter(di.getArchiveTransfer().getDataObjectPackage(), "UTF8", ';', ALL_DATAOBJECTS, false, 0, null); + cme = new DataObjectPackageToCSVMetadataExporter( + di.getArchiveTransfer().getDataObjectPackage(), + "UTF8", + ';', + ALL_DATAOBJECTS, + false, + 0, + null + ); cme.doExportToCSVZip("target/tmpJunit/CSVMetadataExporterZIP/ExportedMetadata.zip", "metadata.csv"); - unzip("target/tmpJunit/CSVMetadataExporterZIP/ExportedMetadata.zip", "target/tmpJunit/CSVMetadataExporterZIP/unzip"); - unzip("src/test/resources/ExpectedResults/ExportedMetadata.zip", "target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"); + unzip( + "target/tmpJunit/CSVMetadataExporterZIP/ExportedMetadata.zip", + "target/tmpJunit/CSVMetadataExporterZIP/unzip" + ); + unzip( + "src/test/resources/ExpectedResults/ExportedMetadata.zip", + "target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip" + ); // Then exported directory in the zip is equivalent to imported one - assertThat(compareDirectories(Paths.get("target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"), - Paths.get("target/tmpJunit/CSVMetadataExporterZIP/unzip"))).isTrue(); + assertThat( + compareDirectories( + Paths.get("target/tmpJunit/CSVMetadataExporterZIP/expectedUnzip"), + Paths.get("target/tmpJunit/CSVMetadataExporterZIP/unzip") + ) + ).isTrue(); } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java index 034bde76..b91afa40 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVMetadataToDataObjectPackageImporterTest.java @@ -60,144 +60,165 @@ @ExtendWith(SedaContextExtension.class) class CSVMetadataToDataObjectPackageImporterTest { - @Test - void importOKCSV1column() throws SEDALibException, InterruptedException, JsonProcessingException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - CSVMetadataToDataObjectPackageImporter cmi; - - // When loaded with the csv OK test file - cmi= new CSVMetadataToDataObjectPackageImporter( - "src/test/resources/PacketSamples/MetadataTestOK1col.csv", "windows-1252",';',null); - cmi.doImport(); - - // Then - String testAuID10 = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : null,\n" + - " \"contentXmlData\" : \"\\n RecordGrp\\n Root2\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID10\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - String testAuID17 = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : null,\n" + - " \"contentXmlData\" : \"\\n RecordGrp\\n Root2\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID17\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - // Root2 is either the first or last AU (random order due to hashmap use) - ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("ID17"); - String sau = mapper.writeValueAsString(au); - if (sau.contains("Root2")) - assertThat(sau).isEqualToNormalizingNewlines(testAuID17); - else { - au = cmi.getDataObjectPackage().getArchiveUnitById("ID10"); - sau = mapper.writeValueAsString(au); - assertThat(sau).isEqualToNormalizingNewlines(testAuID10); - } - } - - @Test - void importOKCSV3column() throws SEDALibException, InterruptedException, JsonProcessingException, FileNotFoundException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - CSVMetadataToDataObjectPackageImporter cmi; - - // When loaded with the csv OK test file - cmi= new CSVMetadataToDataObjectPackageImporter( - "src/test/resources/PacketSamples/MetadataTestOK3col.csv", "windows-1252",';',null); - cmi.doImport(); - - // Then - ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("Import-6"); - String sau = mapper.writeValueAsString(au); - assertThat(sau).isEqualToNormalizingNewlines(ResourceUtils.getResourceAsString("import/AU_Import_02.json")); - } - - @Test - void importOKCSV3columnWithManagement() throws SEDALibException, InterruptedException, JsonProcessingException, FileNotFoundException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - CSVMetadataToDataObjectPackageImporter cmi; - - // When loaded with the csv OK test file - cmi= new CSVMetadataToDataObjectPackageImporter( - "src/test/resources/PacketSamples/MetadataTestManagementOK3col.csv", "windows-1252",';',null); - cmi.doImport(); - - ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("Import-6"); - String sau = mapper.writeValueAsString(au); - assertThat(sau).isEqualToNormalizingNewlines(ResourceUtils.getResourceAsString("import/AU_Import_01.json")); - } - - @Test - void importTagKOCSV() throws SEDALibException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - CSVMetadataToDataObjectPackageImporter cmi; - - // When loaded with the csv OK test file - cmi= new CSVMetadataToDataObjectPackageImporter( - "src/test/resources/PacketSamples/MetadataTestTagKO.csv", "windows-1252",';',null); - - assertThatThrownBy(cmi::doImport) - .hasMessageContaining("Caractère interdit"); // for StringType; - } - - @Test - void importLineKOCSV() throws SEDALibException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - - CSVMetadataToDataObjectPackageImporter cmi; - - // When loaded with the csv OK test file - cmi= new CSVMetadataToDataObjectPackageImporter( - "src/test/resources/PacketSamples/MetadataTestLineKO.csv", "windows-1252",';',null); - - assertThatThrownBy(cmi::doImport) - .hasMessageContaining("ligne 4"); // for StringType; - } + @Test + void importOKCSV1column() throws SEDALibException, InterruptedException, JsonProcessingException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + CSVMetadataToDataObjectPackageImporter cmi; + + // When loaded with the csv OK test file + cmi = new CSVMetadataToDataObjectPackageImporter( + "src/test/resources/PacketSamples/MetadataTestOK1col.csv", + "windows-1252", + ';', + null + ); + cmi.doImport(); + + // Then + String testAuID10 = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : null,\n" + + " \"contentXmlData\" : \"\\n RecordGrp\\n Root2\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID10\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + String testAuID17 = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : null,\n" + + " \"contentXmlData\" : \"\\n RecordGrp\\n Root2\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID17\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + // Root2 is either the first or last AU (random order due to hashmap use) + ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("ID17"); + String sau = mapper.writeValueAsString(au); + if (sau.contains("Root2")) assertThat(sau).isEqualToNormalizingNewlines(testAuID17); + else { + au = cmi.getDataObjectPackage().getArchiveUnitById("ID10"); + sau = mapper.writeValueAsString(au); + assertThat(sau).isEqualToNormalizingNewlines(testAuID10); + } + } + + @Test + void importOKCSV3column() + throws SEDALibException, InterruptedException, JsonProcessingException, FileNotFoundException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + CSVMetadataToDataObjectPackageImporter cmi; + + // When loaded with the csv OK test file + cmi = new CSVMetadataToDataObjectPackageImporter( + "src/test/resources/PacketSamples/MetadataTestOK3col.csv", + "windows-1252", + ';', + null + ); + cmi.doImport(); + + // Then + ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("Import-6"); + String sau = mapper.writeValueAsString(au); + assertThat(sau).isEqualToNormalizingNewlines(ResourceUtils.getResourceAsString("import/AU_Import_02.json")); + } + + @Test + void importOKCSV3columnWithManagement() + throws SEDALibException, InterruptedException, JsonProcessingException, FileNotFoundException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + CSVMetadataToDataObjectPackageImporter cmi; + + // When loaded with the csv OK test file + cmi = new CSVMetadataToDataObjectPackageImporter( + "src/test/resources/PacketSamples/MetadataTestManagementOK3col.csv", + "windows-1252", + ';', + null + ); + cmi.doImport(); + + ArchiveUnit au = cmi.getDataObjectPackage().getArchiveUnitById("Import-6"); + String sau = mapper.writeValueAsString(au); + assertThat(sau).isEqualToNormalizingNewlines(ResourceUtils.getResourceAsString("import/AU_Import_01.json")); + } + + @Test + void importTagKOCSV() throws SEDALibException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + CSVMetadataToDataObjectPackageImporter cmi; + + // When loaded with the csv OK test file + cmi = new CSVMetadataToDataObjectPackageImporter( + "src/test/resources/PacketSamples/MetadataTestTagKO.csv", + "windows-1252", + ';', + null + ); + + assertThatThrownBy(cmi::doImport).hasMessageContaining("Caractère interdit"); // for StringType; + } + + @Test + void importLineKOCSV() throws SEDALibException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + + CSVMetadataToDataObjectPackageImporter cmi; + + // When loaded with the csv OK test file + cmi = new CSVMetadataToDataObjectPackageImporter( + "src/test/resources/PacketSamples/MetadataTestLineKO.csv", + "windows-1252", + ';', + null + ); + + assertThatThrownBy(cmi::doImport).hasMessageContaining("ligne 4"); // for StringType; + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java index 39855e45..15f137dd 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CSVTreeToDataObjectPackageImporterTest.java @@ -57,60 +57,68 @@ @ExtendWith(SedaContextExtension.class) class CSVTreeToDataObjectPackageImporterTest { - @Test - void importOKCSV() throws SEDALibException, InterruptedException, JsonProcessingException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + @Test + void importOKCSV() throws SEDALibException, InterruptedException, JsonProcessingException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - CSVTreeToDataObjectPackageImporter cti; + CSVTreeToDataObjectPackageImporter cti; - // When loaded with the csv OK test file - cti= new CSVTreeToDataObjectPackageImporter( - "src/test/resources/PacketSamples/TestOK.csv", "Cp1252",';',null); - cti.doImport(); + // When loaded with the csv OK test file + cti = new CSVTreeToDataObjectPackageImporter( + "src/test/resources/PacketSamples/TestOK.csv", + "Cp1252", + ';', + null + ); + cti.doImport(); - // Then - String testAu = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : null,\n" + - " \"contentXmlData\" : \"\\n Subseries\\n Justice\\n REP.7.\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID36\", \"ID37\", \"ID38\", \"ID39\", \"ID40\", \"ID41\", \"ID42\", \"ID43\", \"ID44\", \"ID45\", \"ID46\", \"ID47\", \"ID48\", \"ID49\" ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID35\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - ArchiveUnit au = cti.getDataObjectPackage().getArchiveUnitById("ID35"); - String sau = mapper.writeValueAsString(au); - assertThat(sau).isEqualToNormalizingNewlines(testAu); - } + // Then + String testAu = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : null,\n" + + " \"contentXmlData\" : \"\\n Subseries\\n Justice\\n REP.7.\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID36\", \"ID37\", \"ID38\", \"ID39\", \"ID40\", \"ID41\", \"ID42\", \"ID43\", \"ID44\", \"ID45\", \"ID46\", \"ID47\", \"ID48\", \"ID49\" ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID35\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + ArchiveUnit au = cti.getDataObjectPackage().getArchiveUnitById("ID35"); + String sau = mapper.writeValueAsString(au); + assertThat(sau).isEqualToNormalizingNewlines(testAu); + } - @Test - void importKOCSV() throws SEDALibException { - // Given - ObjectMapper mapper = new ObjectMapper(); - SimpleModule module = new SimpleModule(); - module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); - module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); - mapper.registerModule(module); - mapper.enable(SerializationFeature.INDENT_OUTPUT); + @Test + void importKOCSV() throws SEDALibException { + // Given + ObjectMapper mapper = new ObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(DataObjectPackage.class, new DataObjectPackageSerializer()); + module.addDeserializer(DataObjectPackage.class, new DataObjectPackageDeserializer()); + mapper.registerModule(module); + mapper.enable(SerializationFeature.INDENT_OUTPUT); - CSVTreeToDataObjectPackageImporter cti; + CSVTreeToDataObjectPackageImporter cti; - // When loaded with the csv KO test file with a line out of all defined series - cti= new CSVTreeToDataObjectPackageImporter( - "src/test/resources/PacketSamples/TestKO1.csv", "Cp1252",';',null); + // When loaded with the csv KO test file with a line out of all defined series + cti = new CSVTreeToDataObjectPackageImporter( + "src/test/resources/PacketSamples/TestKO1.csv", + "Cp1252", + ';', + null + ); - // Test message identify the wrong line - assertThatThrownBy(cti::doImport) - .hasMessageContaining("2b"); // for StringType; - } + // Test message identify the wrong line + assertThatThrownBy(cti::doImport).hasMessageContaining("2b"); // for StringType; + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java index 82e95e04..852bf583 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/CompressedFileImportTest.java @@ -63,10 +63,14 @@ class CompressedFileImportTest implements UseTestFiles { @Test void TestZipImport() throws Exception { - // do import of test directory CompressedFileToArchiveTransferImporter zi = new CompressedFileToArchiveTransferImporter( - "src/test/resources/zip/TestImport.zip", "target/tmpJunit/TestImport.zip-tmpdir", "UTF8", null, null); + "src/test/resources/zip/TestImport.zip", + "target/tmpJunit/TestImport.zip-tmpdir", + "UTF8", + null, + null + ); zi.addIgnorePattern("Thumbs.db"); zi.addIgnorePattern("pagefile.sys"); zi.doImport(); @@ -84,146 +88,151 @@ void TestZipImport() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); // assert one dataObjectGroup using serialization - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 50651\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"OpenDocument Spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/294\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2025-04-27T20:15:14.696302Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID17\",\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\TestImport.zip-tmpdir\\\\Root\\\\Node 1\\\\Node 1.1\\\\__BinaryMaster_1__201609-TdB-suivi-des-a.ods\"\n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"TextContent_1\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 3307\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Plain Text File\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"text/plain\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"x-fmt/111\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2025-04-27T20:15:14.696302Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID19\",\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\TestImport.zip-tmpdir\\\\Root\\\\Node 1\\\\Node 1.1\\\\__TextContent_1__201609-TdB-suivi-des-a.txt\"\n" + - " } ],\n" + - " \"physicalDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"PhysicalMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"PhysicalId\",\n" + - " \"value\" : \"940 W\"\n" + - " }, {\n" + - " \"type\" : \"PhysicalDimensions\",\n" + - " \"elementName\" : \"PhysicalDimensions\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Width\",\n" + - " \"value\" : 10.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Height\",\n" + - " \"value\" : 8.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Depth\",\n" + - " \"value\" : 1.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Diameter\",\n" + - " \"value\" : 0.0,\n" + - " \"unit\" : \"centimetre\"\n" + - " }, {\n" + - " \"type\" : \"Weight\",\n" + - " \"elementName\" : \"Weight\",\n" + - " \"value\" : 59.0,\n" + - " \"unit\" : \"gram\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID18\",\n" + - " \"onDiskPath\" : null\n" + - " } ],\n" + - " \"logBook\" : null,\n" + - " \"inDataObjectPackageId\" : \"ID16\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - DataObjectGroup og = zi.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().get("ID16"); - //System.out.println("Value to verify="+mapper.writeValueAsString(og)); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 50651\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"OpenDocument Spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/294\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2025-04-27T20:15:14.696302Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID17\",\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\TestImport.zip-tmpdir\\\\Root\\\\Node 1\\\\Node 1.1\\\\__BinaryMaster_1__201609-TdB-suivi-des-a.ods\"\n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"TextContent_1\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 3307\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Plain Text File\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"text/plain\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"x-fmt/111\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2025-04-27T20:15:14.696302Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID19\",\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\TestImport.zip-tmpdir\\\\Root\\\\Node 1\\\\Node 1.1\\\\__TextContent_1__201609-TdB-suivi-des-a.txt\"\n" + + " } ],\n" + + " \"physicalDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"PhysicalMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"PhysicalId\",\n" + + " \"value\" : \"940 W\"\n" + + " }, {\n" + + " \"type\" : \"PhysicalDimensions\",\n" + + " \"elementName\" : \"PhysicalDimensions\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Width\",\n" + + " \"value\" : 10.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Height\",\n" + + " \"value\" : 8.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Depth\",\n" + + " \"value\" : 1.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Diameter\",\n" + + " \"value\" : 0.0,\n" + + " \"unit\" : \"centimetre\"\n" + + " }, {\n" + + " \"type\" : \"Weight\",\n" + + " \"elementName\" : \"Weight\",\n" + + " \"value\" : 59.0,\n" + + " \"unit\" : \"gram\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID18\",\n" + + " \"onDiskPath\" : null\n" + + " } ],\n" + + " \"logBook\" : null,\n" + + " \"inDataObjectPackageId\" : \"ID16\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + DataObjectGroup og = zi + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID16"); + //System.out.println("Value to verify="+mapper.writeValueAsString(og)); String sog = mapper.writeValueAsString(og); sog = sog.replaceAll("\"dateTimeString\" : .*", "").trim(); Pattern pog = Pattern.compile("\"onDiskPath\" : .*Node 1.1"); @@ -240,19 +249,20 @@ void TestZipImport() throws Exception { assertThat(sog).isEqualToNormalizingNewlines(testog); // assert one archiveUnit using serialization - String testau = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : \"\\n \\n ACC-00002\\n 2015-11-19\\n \\n\",\n" + - " \"contentXmlData\" : \"\\n Item\\n CSIC Tech : points remarquables PMO\\n <79980C36BA239C449A9575FE17591F3D0C237AD1@prd-exch-b01.solano.alize>\\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n \\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n \\n \\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n \\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n 2016-08-30T10:14:17Z\\n 2016-08-30T10:14:18Z\\n Bonjour,\\n\\nVous trouverez ci-joint les éléments collectés au mois de juillet sous forme de tableur correspondant à l'avancement de vos activités. Afin de publier une mise à jour en CSIC Tech, merci de mettre à jour les éléments pour le jeudi 08 septembre au plus tard. Sans retour de votre part, je tiendrai compte de la dernière mise à jour.\\n\\nPour rappel :\\n- L'objectif est de remonter l'état des activités (statut, livrable/jalon, points importants).\\n- Les colonnes de N à V sont à mettre à jour si nécessaire (fond orange clair).\\n\\nMerci par avance.\\n\\nBien cordialement,\\n\\n\\n[http://www.modernisation.gouv.fr/sites/default/files/bloc-sgmap-2.jpg]< http://www.modernisation.gouv.fr/>\\n\\nBenjamin PLANCHOT | PMO\\nService « performance des services numériques »\\nDirection interministérielle du numérique et du système d'information et de communication de l'Etat\\n01 40 15 71 50 | Tour Mirabeau - 39-43 Quai André Citroën, 75015 Paris - Bureau 4027\\nmodernisation.gouv.fr< http://www.modernisation.gouv.fr/>\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID15\", \"ID20\" ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID12\" ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID11\",\n" + - " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\"\n" + - "}"; + String testau = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : \"\\n \\n ACC-00002\\n 2015-11-19\\n \\n\",\n" + + " \"contentXmlData\" : \"\\n Item\\n CSIC Tech : points remarquables PMO\\n <79980C36BA239C449A9575FE17591F3D0C237AD1@prd-exch-b01.solano.alize>\\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n \\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n \\n \\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n \\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n 2016-08-30T10:14:17Z\\n 2016-08-30T10:14:18Z\\n Bonjour,\\n\\nVous trouverez ci-joint les éléments collectés au mois de juillet sous forme de tableur correspondant à l'avancement de vos activités. Afin de publier une mise à jour en CSIC Tech, merci de mettre à jour les éléments pour le jeudi 08 septembre au plus tard. Sans retour de votre part, je tiendrai compte de la dernière mise à jour.\\n\\nPour rappel :\\n- L'objectif est de remonter l'état des activités (statut, livrable/jalon, points importants).\\n- Les colonnes de N à V sont à mettre à jour si nécessaire (fond orange clair).\\n\\nMerci par avance.\\n\\nBien cordialement,\\n\\n\\n[http://www.modernisation.gouv.fr/sites/default/files/bloc-sgmap-2.jpg]< http://www.modernisation.gouv.fr/>\\n\\nBenjamin PLANCHOT | PMO\\nService « performance des services numériques »\\nDirection interministérielle du numérique et du système d'information et de communication de l'Etat\\n01 40 15 71 50 | Tour Mirabeau - 39-43 Quai André Citroën, 75015 Paris - Bureau 4027\\nmodernisation.gouv.fr< http://www.modernisation.gouv.fr/>\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID15\", \"ID20\" ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID12\" ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID11\",\n" + + " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\"\n" + + "}"; Pattern pau = Pattern.compile("\"onDiskPath\" : .*Node 1\""); Matcher mtestau = pau.matcher(testau); diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java index 001e4cfc..e270c69b 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/DiskImportExportTest.java @@ -64,10 +64,11 @@ class DiskImportExportTest implements UseTestFiles { @Test void TestDiskImportWithoutLink() throws Exception { - // do import of test directory DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", null); + "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); di.doImport(); @@ -85,105 +86,110 @@ void TestDiskImportWithoutLink() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); // assert one dataObjectGroup using serialization - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 50651\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"OpenDocument Spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/294\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID14\",\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\\\\Node 1.1\\\\__BinaryMaster_1_201609-TdB-suivi-des-a.ods\"\n" + - " }, {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"TextContent_1\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 3307\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Plain Text File\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"text/plain\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"x-fmt/111\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID15\",\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\\\\Node 1.1\\\\__TextContent_1_201609-TdB-suivi-des-a.txt\"\n" + - " } ],\n" + - " \"physicalDataObjectList\" : [ ],\n" + - " \"logBook\" : null,\n" + - " \"inDataObjectPackageId\" : \"ID13\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - DataObjectGroup og = di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().get("ID13"); - //System.out.println("Value to verify="+mapper.writeValueAsString(og)); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"ccc63de7306ced0b656f8f5bcb718304fefa93baed5bdb6e523146ff9ff9795ad22fff6077110fbd171df9553a24554fd5aa2b72cf76ffb4c24c7371be5f774e\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 50651\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"OpenDocument Spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"application/vnd.oasis.opendocument.spreadsheet\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/294\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.ods\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID14\",\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\\\\Node 1.1\\\\__BinaryMaster_1_201609-TdB-suivi-des-a.ods\"\n" + + " }, {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"TextContent_1\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"7040a2d9f0a4ba697fde735cbe12f462af609eda6e35a0f3ddbddddbdaf8ffdd394c37a59bbb8ea4238f13169e0d634fa75cf3b251c4607144010d3552a87dd2\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 3307\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Plain Text File\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"text/plain\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"x-fmt/111\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"201609-TdB-suivi-des-a.txt\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID15\",\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\\\\Node 1.1\\\\__TextContent_1_201609-TdB-suivi-des-a.txt\"\n" + + " } ],\n" + + " \"physicalDataObjectList\" : [ ],\n" + + " \"logBook\" : null,\n" + + " \"inDataObjectPackageId\" : \"ID13\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + DataObjectGroup og = di + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID13"); + //System.out.println("Value to verify="+mapper.writeValueAsString(og)); String sog = mapper.writeValueAsString(og).replaceAll("\"dateTimeString\" : .*", ""); Pattern pog = Pattern.compile("\"onDiskPath\" : .*Node 1.1"); Matcher msog = pog.matcher(sog); @@ -199,19 +205,20 @@ void TestDiskImportWithoutLink() throws Exception { assertThat(sog).isEqualToNormalizingNewlines(testog); // assert one archiveUnit using serialization - String testau = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : \"\\n \\n ACC-00002\\n 2015-11-19\\n \\n\",\n" + - " \"contentXmlData\" : \"\\n Item\\n CSIC Tech : points remarquables PMO\\n <79980C36BA239C449A9575FE17591F3D0C237AD1@prd-exch-b01.solano.alize>\\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n \\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n \\n \\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n \\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n 2016-08-30T10:14:17Z\\n 2016-08-30T10:14:18Z\\n Bonjour,\\n\\nVous trouverez ci-joint les éléments collectés au mois de juillet sous forme de tableur correspondant à l'avancement de vos activités. Afin de publier une mise à jour en CSIC Tech, merci de mettre à jour les éléments pour le jeudi 08 septembre au plus tard. Sans retour de votre part, je tiendrai compte de la dernière mise à jour.\\n\\nPour rappel :\\n- L'objectif est de remonter l'état des activités (statut, livrable/jalon, points importants).\\n- Les colonnes de N à V sont à mettre à jour si nécessaire (fond orange clair).\\n\\nMerci par avance.\\n\\nBien cordialement,\\n\\n\\n[http://www.modernisation.gouv.fr/sites/default/files/bloc-sgmap-2.jpg]< http://www.modernisation.gouv.fr/>\\n\\nBenjamin PLANCHOT | PMO\\nService « performance des services numériques »\\nDirection interministérielle du numérique et du système d'information et de communication de l'Etat\\n01 40 15 71 50 | Tour Mirabeau - 39-43 Quai André Citroën, 75015 Paris - Bureau 4027\\nmodernisation.gouv.fr< http://www.modernisation.gouv.fr/>\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID12\", \"ID16\" ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID19\" ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID11\",\n" + - " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\"\n" + - "}"; + String testau = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : \"\\n \\n ACC-00002\\n 2015-11-19\\n \\n\",\n" + + " \"contentXmlData\" : \"\\n Item\\n CSIC Tech : points remarquables PMO\\n <79980C36BA239C449A9575FE17591F3D0C237AD1@prd-exch-b01.solano.alize>\\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n \\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n frederic.deguilhen@culture.gouv.fr\\n \\n \\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n jean-severin.lair@culture.gouv.fr\\n \\n \\n PLANCHOT Benjamin\\n PLANCHOT Benjamin\\n benjamin.planchot@modernisation.gouv.fr\\n \\n 2016-08-30T10:14:17Z\\n 2016-08-30T10:14:18Z\\n Bonjour,\\n\\nVous trouverez ci-joint les éléments collectés au mois de juillet sous forme de tableur correspondant à l'avancement de vos activités. Afin de publier une mise à jour en CSIC Tech, merci de mettre à jour les éléments pour le jeudi 08 septembre au plus tard. Sans retour de votre part, je tiendrai compte de la dernière mise à jour.\\n\\nPour rappel :\\n- L'objectif est de remonter l'état des activités (statut, livrable/jalon, points importants).\\n- Les colonnes de N à V sont à mettre à jour si nécessaire (fond orange clair).\\n\\nMerci par avance.\\n\\nBien cordialement,\\n\\n\\n[http://www.modernisation.gouv.fr/sites/default/files/bloc-sgmap-2.jpg]< http://www.modernisation.gouv.fr/>\\n\\nBenjamin PLANCHOT | PMO\\nService « performance des services numériques »\\nDirection interministérielle du numérique et du système d'information et de communication de l'Etat\\n01 40 15 71 50 | Tour Mirabeau - 39-43 Quai André Citroën, 75015 Paris - Bureau 4027\\nmodernisation.gouv.fr< http://www.modernisation.gouv.fr/>\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID12\", \"ID16\" ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID19\" ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID11\",\n" + + " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithoutLinksModelV1\\\\Root\\\\Node 1\"\n" + + "}"; Pattern pau = Pattern.compile("\"onDiskPath\" : .*Node 1\""); Matcher mtestau = pau.matcher(testau); @@ -231,7 +238,6 @@ void TestDiskImportWithoutLink() throws Exception { @Test void TestDiskImportWithLink() throws Exception { - // do import of test directory DiskToArchiveTransferImporter di; di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithLinksModelV2", null); @@ -241,8 +247,8 @@ void TestDiskImportWithLink() throws Exception { di.doImport(); // assert macro results - assertEquals(22,di.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); - assertEquals(11,di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); + assertEquals(22, di.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().size()); + assertEquals(11, di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().size()); // create jackson object mapper ObjectMapper mapper = new ObjectMapper(); @@ -253,61 +259,66 @@ void TestDiskImportWithLink() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); // assert one dataObjectGroup using serialization - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\",\n" + - " \"algorithm\" : \"SHA-512\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 21232\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Exchangeable Image File Format (Compressed)\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"image/jpeg\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"fmt/645\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"image001.jpg\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"elementName\" : \"LastModified\",\n" + - " \"dateTimeString\" : \"2025-02-12T19:30:16.677800700Z\"\n" + - " } ]\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID13\",\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithLinksModelV2\\\\Root\\\\Node 1\\\\Node 1.2\\\\__BinaryMaster_1__image001.jpg\"\n" + - " } ],\n" + - " \"physicalDataObjectList\" : [ ],\n" + - " \"logBook\" : null,\n" + - " \"inDataObjectPackageId\" : \"ID12\",\n" + - " \"onDiskPath\" : null\n" + - "}"; - - DataObjectGroup og = di.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().get("ID12"); - //System.out.println("Value to verify="+mapper.writeValueAsString(og)); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"e321b289f1800e5fa3be1b8d01687c8999ef3ecfec759bd0e19ccd92731036755c8f79cbd4af8f46fc5f4e14ad805f601fe2e9b58ad0b9f5a13695c0123e45b3\",\n" + + " \"algorithm\" : \"SHA-512\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 21232\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Exchangeable Image File Format (Compressed)\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"image/jpeg\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"fmt/645\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"image001.jpg\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"elementName\" : \"LastModified\",\n" + + " \"dateTimeString\" : \"2025-02-12T19:30:16.677800700Z\"\n" + + " } ]\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID13\",\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\src\\\\test\\\\resources\\\\PacketSamples\\\\SampleWithLinksModelV2\\\\Root\\\\Node 1\\\\Node 1.2\\\\__BinaryMaster_1__image001.jpg\"\n" + + " } ],\n" + + " \"physicalDataObjectList\" : [ ],\n" + + " \"logBook\" : null,\n" + + " \"inDataObjectPackageId\" : \"ID12\",\n" + + " \"onDiskPath\" : null\n" + + "}"; + + DataObjectGroup og = di + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID12"); + //System.out.println("Value to verify="+mapper.writeValueAsString(og)); String sog = mapper.writeValueAsString(og); Pattern pog = Pattern.compile("\"onDiskPath\" : .*Node 1.2"); Matcher msog = pog.matcher(sog); @@ -324,14 +335,20 @@ void TestDiskImportWithLink() throws Exception { assertThat(sog).isEqualToNormalizingNewlines(testog); // assert one archiveUnit using serialization - String testau = "{\n" + " \"archiveUnitProfileXmlData\" : null,\n" + " \"managementXmlData\" : null,\n" - + " \"contentXmlData\" : \"\\n RecordGrp\\n Node 2.3 - Many\\n\",\n" - + " \"childrenAuList\" : {\n" - + " \"inDataObjectPackageIdList\" : [ \"ID43\", \"ID46\", \"ID49\", \"ID16\", \"ID52\", \"ID55\" ]\n" - + " },\n" + " \"dataObjectRefList\" : {\n" + " \"inDataObjectPackageIdList\" : [ ]\n" + " },\n" - + " \"inDataObjectPackageId\" : \"ID40\",\n" - + " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\git\\\\sedalib\\\\src\\\\test\\\\ressources\\\\PacketSamples\\\\SampleWithWindowsLinksAndShortcutsModelV2\\\\Root\\\\Node 2\\\\Node 2.3 - Many\"\n" - + "}"; + String testau = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : null,\n" + + " \"contentXmlData\" : \"\\n RecordGrp\\n Node 2.3 - Many\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID43\", \"ID46\", \"ID49\", \"ID16\", \"ID52\", \"ID55\" ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID40\",\n" + + " \"onDiskPath\" : \"F:\\\\DocumentsPerso\\\\JS\\\\git\\\\sedalib\\\\src\\\\test\\\\ressources\\\\PacketSamples\\\\SampleWithWindowsLinksAndShortcutsModelV2\\\\Root\\\\Node 2\\\\Node 2.3 - Many\"\n" + + "}"; Pattern pau = Pattern.compile("\"onDiskPath\" : .*Node 2.3 - Many\""); Matcher mtestau = pau.matcher(testau); @@ -340,7 +357,7 @@ void TestDiskImportWithLink() throws Exception { ArchiveUnit au = di.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID40"); String sau = mapper.writeValueAsString(au); -// System.out.println(sau); + // System.out.println(sau); Matcher msau = pau.matcher(sau); boolean saupath = msau.find(); sau = sau.replaceAll("\"onDiskPath\" : .*\"", ""); @@ -349,15 +366,18 @@ void TestDiskImportWithLink() throws Exception { assertThat(sau).isEqualToNormalizingNewlines(testau); } - static Function replaced = s->"Replaced"; + static Function replaced = s -> "Replaced"; @Test void TestDiskImportWithLinkIgnoringLinksAndExtractingTitle() throws Exception { - // do import of test directory DiskToArchiveTransferImporter di; - di = new DiskToArchiveTransferImporter("src/test/resources/PacketSamples/SampleWithLinksModelV2", - true,replaced,null); + di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithLinksModelV2", + true, + replaced, + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -376,19 +396,20 @@ void TestDiskImportWithLinkIgnoringLinksAndExtractingTitle() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); // assert one archiveUnit using serialization - String testau = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"managementXmlData\" : null,\n" + - " \"contentXmlData\" : \"\\n RecordGrp\\n Replaced\\n\",\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID56\",\n" + - " \n" + - "}"; + String testau = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"managementXmlData\" : null,\n" + + " \"contentXmlData\" : \"\\n RecordGrp\\n Replaced\\n\",\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID56\",\n" + + " \n" + + "}"; testau = testau.replaceAll("\"onDiskPath\" : .*\"", ""); diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java index d5753e62..0b172063 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SEDAValidationTest.java @@ -65,48 +65,52 @@ @ExtendWith(SedaContextExtension.class) class SEDAValidationTest implements UseTestFiles { - @Test - void testSedaXmlValidationOK() - throws IllegalArgumentException, SEDALibException, InterruptedException { - - // do import of test directory - DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithLinksModelV2", null); - di.addIgnorePattern("Thumbs.db"); - di.addIgnorePattern("pagefile.sys"); + @Test + void testSedaXmlValidationOK() throws IllegalArgumentException, SEDALibException, InterruptedException { + // do import of test directory + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithLinksModelV2", + null + ); + di.addIgnorePattern("Thumbs.db"); + di.addIgnorePattern("pagefile.sys"); - di.doImport(); + di.doImport(); - di.getArchiveTransfer().setGlobalMetadata(new GlobalMetadata()); - di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; - di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; - di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; - di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" - + " ReplyCodeListVersion0\n" - + "MessageDigestAlgorithmCodeListVersion0\n" - + "MimeTypeCodeListVersion0\n" - + "EncodingCodeListVersion0\n" - + "FileFormatCodeListVersion0\n" - + "CompressionAlgorithmCodeListVersion0\n" - + "DataObjectVersionCodeListVersion0\n" - + "StorageRuleCodeListVersion0\n" - + "AppraisalRuleCodeListVersion0\n" - + "AccessRuleCodeListVersion0\n" - + "DisseminationRuleCodeListVersion0\n" - + "ReuseRuleCodeListVersion0\n" - + "ClassificationRuleCodeListVersion0\n" - + "AuthorizationReasonCodeListVersion0\n" - + "RelationshipCodeListVersion0\n" - + " "; - di.getArchiveTransfer().getDataObjectPackage() - .setManagementMetadataXmlData("\n" - + " Acquisition Information\n" - + "Public Archive\n" - + "Service_producteur\n" - + "Service_versant\n" - + " "); - di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; - di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; + di.getArchiveTransfer().setGlobalMetadata(new GlobalMetadata()); + di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; + di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; + di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; + di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" + + " ReplyCodeListVersion0\n" + + "MessageDigestAlgorithmCodeListVersion0\n" + + "MimeTypeCodeListVersion0\n" + + "EncodingCodeListVersion0\n" + + "FileFormatCodeListVersion0\n" + + "CompressionAlgorithmCodeListVersion0\n" + + "DataObjectVersionCodeListVersion0\n" + + "StorageRuleCodeListVersion0\n" + + "AppraisalRuleCodeListVersion0\n" + + "AccessRuleCodeListVersion0\n" + + "DisseminationRuleCodeListVersion0\n" + + "ReuseRuleCodeListVersion0\n" + + "ClassificationRuleCodeListVersion0\n" + + "AuthorizationReasonCodeListVersion0\n" + + "RelationshipCodeListVersion0\n" + + " "; + di + .getArchiveTransfer() + .getDataObjectPackage() + .setManagementMetadataXmlData( + "\n" + + " Acquisition Information\n" + + "Public Archive\n" + + "Service_producteur\n" + + "Service_versant\n" + + " " + ); + di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; + di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; // validation assertAll(() -> di.getArchiveTransfer().sedaSchemaValidate(null)); @@ -114,12 +118,13 @@ void testSedaXmlValidationOK() @Test void testSedaXmlArchiveTransferGenerationAndValidationForSedaVersion2() - throws IllegalArgumentException, SEDALibException, InterruptedException { - + throws IllegalArgumentException, SEDALibException, InterruptedException { // do import of test directory SedaContext.setVersion(SedaVersion.V2_2); DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithLinksModelV2", null); + "src/test/resources/PacketSamples/SampleWithLinksModelV2", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); @@ -129,42 +134,48 @@ void testSedaXmlArchiveTransferGenerationAndValidationForSedaVersion2() di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; - di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" - + " ReplyCodeListVersion0\n" - + "MessageDigestAlgorithmCodeListVersion0\n" - + "MimeTypeCodeListVersion0\n" - + "EncodingCodeListVersion0\n" - + "FileFormatCodeListVersion0\n" - + "CompressionAlgorithmCodeListVersion0\n" - + "DataObjectVersionCodeListVersion0\n" - + "StorageRuleCodeListVersion0\n" - + "AppraisalRuleCodeListVersion0\n" - + "AccessRuleCodeListVersion0\n" - + "DisseminationRuleCodeListVersion0\n" - + "ReuseRuleCodeListVersion0\n" - + "ClassificationRuleCodeListVersion0\n" - + "HoldRuleCodeListVersion0\n" - + "AuthorizationReasonCodeListVersion0\n" - + "RelationshipCodeListVersion0\n" - + " "; - di.getArchiveTransfer().getDataObjectPackage() - .setManagementMetadataXmlData("\n" - + " Acquisition Information\n" - + "Public Archive\n" - + "Service_producteur\n" - + "Service_versant\n" - + " "); + di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" + + " ReplyCodeListVersion0\n" + + "MessageDigestAlgorithmCodeListVersion0\n" + + "MimeTypeCodeListVersion0\n" + + "EncodingCodeListVersion0\n" + + "FileFormatCodeListVersion0\n" + + "CompressionAlgorithmCodeListVersion0\n" + + "DataObjectVersionCodeListVersion0\n" + + "StorageRuleCodeListVersion0\n" + + "AppraisalRuleCodeListVersion0\n" + + "AccessRuleCodeListVersion0\n" + + "DisseminationRuleCodeListVersion0\n" + + "ReuseRuleCodeListVersion0\n" + + "ClassificationRuleCodeListVersion0\n" + + "HoldRuleCodeListVersion0\n" + + "AuthorizationReasonCodeListVersion0\n" + + "RelationshipCodeListVersion0\n" + + " "; + di + .getArchiveTransfer() + .getDataObjectPackage() + .setManagementMetadataXmlData( + "\n" + + " Acquisition Information\n" + + "Public Archive\n" + + "Service_producteur\n" + + "Service_versant\n" + + " " + ); di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; ArchiveUnit au = di.getArchiveTransfer().getDataObjectPackage().getArchiveUnitById("ID11"); BinaryDataObject bdo = (BinaryDataObject) au.getTheDataObjectGroup().getBinaryDataObjectList().get(0); - bdo.addMetadata(new StringType("DataObjectProfile", "Test")); + bdo.addMetadata(new StringType("DataObjectProfile", "Test")); // validation assertAll(() -> di.getArchiveTransfer().sedaSchemaValidate(null)); - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2)) { + try ( + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SEDAXMLStreamWriter xmlWriter = new SEDAXMLStreamWriter(baos, 2) + ) { di.getArchiveTransfer().toSedaXml(xmlWriter, true, null); String atout = baos.toString(StandardCharsets.UTF_8); assertThat(atout).contains("fr:gouv:culture:archivesdefrance:seda:v2.2"); @@ -175,85 +186,94 @@ void testSedaXmlArchiveTransferGenerationAndValidationForSedaVersion2() SedaContext.setVersion(SedaVersion.V2_1); } - @Test - void testSedaXmlValidationKO() - throws IllegalArgumentException, SEDALibException, InterruptedException { - - // do import of test directory - DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithLinksModelV2", null); - di.addIgnorePattern("Thumbs.db"); - di.addIgnorePattern("pagefile.sys"); - - di.doImport(); + @Test + void testSedaXmlValidationKO() throws IllegalArgumentException, SEDALibException, InterruptedException { + // do import of test directory + DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( + "src/test/resources/PacketSamples/SampleWithLinksModelV2", + null + ); + di.addIgnorePattern("Thumbs.db"); + di.addIgnorePattern("pagefile.sys"); - di.getArchiveTransfer().setGlobalMetadata(new GlobalMetadata()); - di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; - di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; - di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; - di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" - + " ReplyCodeListVersion0\n" - + "MessageDigestAlgorithmCodeListVersion0\n" - + "MimeTypeCodeListVersion0\n" - + "EncodingCodeListVersion0\n" - + "FileFormatCodeListVersion0\n" - + "CompressionAlgorithmCodeListVersion0\n" - + "DataObjectVersionCodeListVersion0\n" - + "StorageRuleCodeListVersion0\n" - + "AppraisalRuleCodeListVersion0\n" - + "AccessRuleCodeListVersion0\n" - + "DisseminationRuleCodeListVersion0\n" - + "ReuseRuleCodeListVersion0\n" - + "ClassificationRuleCodeListVersion0\n" - + "AuthorizationReasonCodeListVersion0\n" - + "RelationshipCodeListVersion0\n" - + " "; - di.getArchiveTransfer().getDataObjectPackage() - .setManagementMetadataXmlData("\n" - + " Acquisition Information\n" - + "Public Archive\n" - + "Service_producteur\n" - + "Service_versant\n" - + " "); - di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; - di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; + di.doImport(); - ArchiveUnit au = di.getArchiveTransfer().getDataObjectPackage().getArchiveUnitById("ID38"); - au.setContentXmlData(""); + di.getArchiveTransfer().setGlobalMetadata(new GlobalMetadata()); + di.getArchiveTransfer().getGlobalMetadata().comment = "2eme SIP"; + di.getArchiveTransfer().getGlobalMetadata().messageIdentifier = "MessageIdentifier0"; + di.getArchiveTransfer().getGlobalMetadata().archivalAgreement = "ArchivalAgreement0"; + di.getArchiveTransfer().getGlobalMetadata().codeListVersionsXmlData = "\n" + + " ReplyCodeListVersion0\n" + + "MessageDigestAlgorithmCodeListVersion0\n" + + "MimeTypeCodeListVersion0\n" + + "EncodingCodeListVersion0\n" + + "FileFormatCodeListVersion0\n" + + "CompressionAlgorithmCodeListVersion0\n" + + "DataObjectVersionCodeListVersion0\n" + + "StorageRuleCodeListVersion0\n" + + "AppraisalRuleCodeListVersion0\n" + + "AccessRuleCodeListVersion0\n" + + "DisseminationRuleCodeListVersion0\n" + + "ReuseRuleCodeListVersion0\n" + + "ClassificationRuleCodeListVersion0\n" + + "AuthorizationReasonCodeListVersion0\n" + + "RelationshipCodeListVersion0\n" + + " "; + di + .getArchiveTransfer() + .getDataObjectPackage() + .setManagementMetadataXmlData( + "\n" + + " Acquisition Information\n" + + "Public Archive\n" + + "Service_producteur\n" + + "Service_versant\n" + + " " + ); + di.getArchiveTransfer().getGlobalMetadata().archivalAgencyIdentifier = "Identifier4"; + di.getArchiveTransfer().getGlobalMetadata().transferringAgencyIdentifier = "Identifier5"; - // validation - assertThatThrownBy(() -> di.getArchiveTransfer().sedaSchemaValidate(null)) - .hasMessageContaining("The content of element 'ArchiveUnit' is not complete"); - } + ArchiveUnit au = di.getArchiveTransfer().getDataObjectPackage().getArchiveUnitById("ID38"); + au.setContentXmlData(""); - @Test - void testSedaRNGProfileValidationOK() - throws IllegalArgumentException, SEDALibException, InterruptedException { - // given - TestUtilities.eraseAll("target/tmpJunit/OK_468.zip-tmpdir"); - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/OK_468.zip", "target/tmpJunit/OK_468.zip-tmpdir", null); - si.doImport(); + // validation + assertThatThrownBy(() -> di.getArchiveTransfer().sedaSchemaValidate(null)).hasMessageContaining( + "The content of element 'ArchiveUnit' is not complete" + ); + } - // when validate then no exception - assertAll(() -> si.getArchiveTransfer() - .sedaProfileValidate("src/test/resources/PacketSamples/profile.rng",null)); - } + @Test + void testSedaRNGProfileValidationOK() throws IllegalArgumentException, SEDALibException, InterruptedException { + // given + TestUtilities.eraseAll("target/tmpJunit/OK_468.zip-tmpdir"); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples/OK_468.zip", + "target/tmpJunit/OK_468.zip-tmpdir", + null + ); + si.doImport(); - @Test - void testSedaRNGProfileValidationKO() - throws IllegalArgumentException, SEDALibException, InterruptedException { - // given - TestUtilities.eraseAll("target/tmpJunit/KO_468.zip-tmpdir"); - SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/KO_468.zip", "target/tmpJunit/KO_468.zip-tmpdir", null); - si.doImport(); + // when validate then no exception + assertAll( + () -> si.getArchiveTransfer().sedaProfileValidate("src/test/resources/PacketSamples/profile.rng", null) + ); + } - // when validate then no exception - assertThatThrownBy(() -> si.getArchiveTransfer() - .sedaProfileValidate("src/test/resources/PacketSamples/profile.rng",null)) - .hasMessageContaining("\"Title\" invalid; must be equal to \"Versement de la matrice cadastrale numérique\""); - } + @Test + void testSedaRNGProfileValidationKO() throws IllegalArgumentException, SEDALibException, InterruptedException { + // given + TestUtilities.eraseAll("target/tmpJunit/KO_468.zip-tmpdir"); + SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( + "src/test/resources/PacketSamples/KO_468.zip", + "target/tmpJunit/KO_468.zip-tmpdir", + null + ); + si.doImport(); + // when validate then no exception + assertThatThrownBy( + () -> si.getArchiveTransfer().sedaProfileValidate("src/test/resources/PacketSamples/profile.rng", null) + ).hasMessageContaining("\"Title\" invalid; must be equal to \"Versement de la matrice cadastrale numérique\""); + } // TODO testWithXSD -} \ No newline at end of file +} diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java index 6cc183a8..2ece24f0 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPBuilderTest.java @@ -70,49 +70,67 @@ class SIPBuilderTest { private static String stripFileName(String fileName) { String tmp = fileName.substring(fileName.indexOf("-") + 1); - if (tmp.lastIndexOf('.') >= 0) - return (tmp.substring(0, tmp.lastIndexOf('.'))); - else - return tmp; + if (tmp.lastIndexOf('.') >= 0) return (tmp.substring(0, tmp.lastIndexOf('.'))); + else return tmp; } @Test void generateSimpleSIP() throws Exception { - TestUtilities.createOrEraseAll("target/tmpJunit/SIPBuilder"); - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("SIPBuilderTest"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("SIPBuilderTest"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("target/tmpJunit/SIPBuilder/SIPBuilderTest.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createRootArchiveUnit("Racine", "Subseries", "Procédure Cerfa-1244771", - "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " - + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)"); - sb.addNewSubArchiveUnit("Racine", "Contexte", "RecordGrp", "Contexte", - "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771"); + sb.createRootArchiveUnit( + "Racine", + "Subseries", + "Procédure Cerfa-1244771", + "Procédure Cerfa-1244771 - DEMANDE D'AUTORISATION DE DETENTION DE GRENOUILLES CYBORG " + + "(Arrêté du 30 février 2104 fixant les règles générales de fonctionnement des installations d’élevage d’agrément d’animaux cyborg)" + ); + sb.addNewSubArchiveUnit( + "Racine", + "Contexte", + "RecordGrp", + "Contexte", + "Ensemble des fichiers donnant le contexte de la procédure Cerfa-1244771" + ); sb.addDiskSubTree("Contexte", "src/test/resources/Procedure/Contexte"); - if (System.getProperty("os.name").toLowerCase().startsWith("win")) - sb.addCSVMetadataSubTree("Racine", "Cp1252", ';', "src/test/resources/MetadataCSV.csv"); - else - sb.addCSVMetadataSubTree("Racine", "Cp1252", ';', "src/test/resources/UnixMetadataCSV.csv"); + if (System.getProperty("os.name").toLowerCase().startsWith("win")) sb.addCSVMetadataSubTree( + "Racine", + "Cp1252", + ';', + "src/test/resources/MetadataCSV.csv" + ); + else sb.addCSVMetadataSubTree("Racine", "Cp1252", ';', "src/test/resources/UnixMetadataCSV.csv"); // keep one file for history in Contexte part and without AppraisalRuleOld ArchiveUnit sampleAU = sb.findArchiveUnitBySimpleDescriptiveMetadata("OriginatingSystemId", "ID10000"); Content c = sb.getContent(sampleAU.getInDataObjectPackageId()); - sb.addNewSubArchiveUnit("Contexte", "Exemple de dossier", - "RecordGrp", "Exemplaire de dossier", - "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:" + - c.getSimpleMetadata("Title") + "\nDescription originale:" + - c.getSimpleMetadata("Description")); + sb.addNewSubArchiveUnit( + "Contexte", + "Exemple de dossier", + "RecordGrp", + "Exemplaire de dossier", + "Ensemble des fichiers d'un dossier pour en conserver la forme.\nTitre original:" + + c.getSimpleMetadata("Title") + + "\nDescription originale:" + + c.getSimpleMetadata("Description") + ); sb.addArchiveUnitSubTree("Exemple de dossier", sampleAU.getInDataObjectPackageId()); sb.generateSIP(); -//TODO Improve test quality + //TODO Improve test quality assertThat(new File("target/tmpJunit/SIPBuilder/SIPBuilderTest.zip")).isFile(); - assertThat(new File("target/tmpJunit/SIPBuilder/SIPBuilderTest.zip").length()).isGreaterThan(10865000).isLessThan(10875000); + assertThat(new File("target/tmpJunit/SIPBuilder/SIPBuilderTest.zip").length()) + .isGreaterThan(10865000) + .isLessThan(10875000); assertAll(sb::sedaSchemaValidate); - } catch (Exception e) { throw new SEDALibException("SIPBuilder test KO"); } @@ -120,15 +138,22 @@ void generateSimpleSIP() throws Exception { @Test void generateComplexSIP() throws Exception { - TestUtilities.createOrEraseAll("target/tmpJunit/SIPBuilder"); - SEDALibProgressLogger pl = new SEDALibProgressLogger(LoggerFactory.getLogger("SIPBuilderTest"), SEDALibProgressLogger.OBJECTS_GROUP); + SEDALibProgressLogger pl = new SEDALibProgressLogger( + LoggerFactory.getLogger("SIPBuilderTest"), + SEDALibProgressLogger.OBJECTS_GROUP + ); try (SIPBuilder sb = new SIPBuilder("target/tmpJunit/SIPBuilder/ComplexSIPBuilderTest.zip", pl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("IC-000001"); - sb.createSystemExistingRootArchiveUnit("Dossiers", "FilePlanPosition", "Dossiers-Cerfa-1244771", - "RecordGrp", "Dossiers"); + sb.createSystemExistingRootArchiveUnit( + "Dossiers", + "FilePlanPosition", + "Dossiers-Cerfa-1244771", + "RecordGrp", + "Dossiers" + ); // iterate through csv Path procDir = Paths.get("src/test/resources/AutresDossiers"); @@ -147,8 +172,13 @@ void generateComplexSIP() throws Exception { procId = "Cerfa-1244771-" + id; // set metadata from csv on the procId ArchiveUnit - sb.addNewSubArchiveUnit("Dossiers", procId, "RecordGrp", procId, - "Ensemble des fichiers de dossier " + procId); + sb.addNewSubArchiveUnit( + "Dossiers", + procId, + "RecordGrp", + procId, + "Ensemble des fichiers de dossier " + procId + ); Content content = sb.getContent(procId); content.addNewMetadata("OriginatingSystemId", procId); content.addNewMetadata("RegisteredDate", registeredDate); @@ -171,16 +201,26 @@ void generateComplexSIP() throws Exception { sb.setManagement(procId, management); // put all proc files in the procId ArchiveUnit - try (DirectoryStream ds = Files.newDirectoryStream(procDir, new DirectoryStream.Filter() { - @Override - public boolean accept(Path entry) throws IOException { - return entry.getFileName().toString().startsWith(id); - } - })) { + try ( + DirectoryStream ds = Files.newDirectoryStream( + procDir, + new DirectoryStream.Filter() { + @Override + public boolean accept(Path entry) throws IOException { + return entry.getFileName().toString().startsWith(id); + } + } + ) + ) { for (Path p : ds) { - if (!p.getFileName().toString().endsWith(".xml")) - sb.addFileSubArchiveUnit(procId, p.toString(), p.getFileName().toString(), "File", - stripFileName(p.getFileName().toString()), null); + if (!p.getFileName().toString().endsWith(".xml")) sb.addFileSubArchiveUnit( + procId, + p.toString(), + p.getFileName().toString(), + "File", + stripFileName(p.getFileName().toString()), + null + ); } } catch (IOException ex) { ex.printStackTrace(); @@ -190,11 +230,13 @@ public boolean accept(Path entry) throws IOException { sb.generateSIP(); -//TODO Improve test quality + //TODO Improve test quality assertThat(new File("target/tmpJunit/SIPBuilder/ComplexSIPBuilderTest.zip")).isFile(); - assertThat(new File("target/tmpJunit/SIPBuilder/ComplexSIPBuilderTest.zip").length()).isGreaterThan(2180000).isLessThan(2190000); + assertThat(new File("target/tmpJunit/SIPBuilder/ComplexSIPBuilderTest.zip").length()) + .isGreaterThan(2180000) + .isLessThan(2190000); } catch (Exception e) { throw new SEDALibException("SIPBuilder test KO"); } } -} \ No newline at end of file +} diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java index f1a3f7d7..d0125ce5 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/SIPImportTest.java @@ -71,11 +71,13 @@ class SIPImportTest implements UseTestFiles { @Test void TestSIPOKImport() throws Exception { - // do import of test directory TestUtilities.eraseAll("target/tmpJunit/SipOK.zip-tmpdir"); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/SIP_OK.zip", "target/tmpJunit/SipOK.zip-tmpdir", null); + "src/test/resources/PacketSamples/SIP_OK.zip", + "target/tmpJunit/SipOK.zip-tmpdir", + null + ); si.doImport(); // assert macro results @@ -92,115 +94,120 @@ void TestSIPOKImport() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); // assert one dataObjectGroup using serialization - String testog = "{\n" + - " \"binaryDataObjectList\" : [ {\n" + - " \"inDataObjectPackageId\" : \"ID13\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"BinaryMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Uri\",\n" + - " \"value\" : \"Content/ID13.txt\"\n" + - " }, {\n" + - " \"type\" : \"DigestType\",\n" + - " \"algorithm\" : \"SHA-512\",\n" + - " \"elementName\" : \"MessageDigest\",\n" + - " \"value\" : \"86c0bc701ef6b5dd21b080bc5bb2af38097baa6237275da83a52f092c9eae3e4e4b0247391620bd732fe824d18bd3bb6c37e62ec73a8cf3585c6a799399861b1\"\n" + - " }, {\n" + - " \"type\" : \"IntegerType\",\n" + - " \"elementName\" : \"Size\",\n" + - " \"value\" : 6\n" + - " }, {\n" + - " \"type\" : \"FormatIdentification\",\n" + - " \"elementName\" : \"FormatIdentification\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatLitteral\",\n" + - " \"value\" : \"Plain Text File\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"MimeType\",\n" + - " \"value\" : \"text/plain\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"FormatId\",\n" + - " \"value\" : \"x-fmt/111\"\n" + - " } ]\n" + - " }, {\n" + - " \"type\" : \"FileInfo\",\n" + - " \"elementName\" : \"FileInfo\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"Filename\",\n" + - " \"value\" : \"Montparnasse.txt\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"CreatingApplicationName\",\n" + - " \"value\" : \"CreatingApplicationName0\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"CreatingApplicationVersion\",\n" + - " \"value\" : \"CreatingApplicationVersion0\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"dateTimeString\" : \"2006-05-04T18:13:51\",\n" + - " \"elementName\" : \"DateCreatedByApplication\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"CreatingOs\",\n" + - " \"value\" : \"CreatingOs0\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"CreatingOsVersion\",\n" + - " \"value\" : \"CreatingOsVersion0\"\n" + - " }, {\n" + - " \"type\" : \"DateTimeType\",\n" + - " \"dateTimeString\" : \"2017-04-04T08:07:06.487+02:00\",\n" + - " \"elementName\" : \"LastModified\"\n" + - " } ]\n" + - " } ],\n" + - " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\SipOK.zip-tmpdir\\\\Content\\\\ID13.txt\"\n" + - " } ],\n" + - " \"inDataObjectPackageId\" : \"ID12\",\n" + - " \"logBook\" : null,\n" + - " \"onDiskPath\" : null,\n" + - " \"physicalDataObjectList\" : [ {\n" + - " \"inDataObjectPackageId\" : \"ID1000\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"DataObjectVersion\",\n" + - " \"value\" : \"PhysicalMaster_1\"\n" + - " }, {\n" + - " \"type\" : \"StringType\",\n" + - " \"elementName\" : \"PhysicalId\",\n" + - " \"value\" : \"12345\"\n" + - " }, {\n" + - " \"type\" : \"PhysicalDimensions\",\n" + - " \"elementName\" : \"PhysicalDimensions\",\n" + - " \"metadataList\" : [ {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Height\",\n" + - " \"unit\" : \"centimetre\",\n" + - " \"value\" : 21.0\n" + - " }, {\n" + - " \"type\" : \"LinearDimensionType\",\n" + - " \"elementName\" : \"Length\",\n" + - " \"unit\" : \"centimetre\",\n" + - " \"value\" : 29.7\n" + - " }, {\n" + - " \"type\" : \"Weight\",\n" + - " \"elementName\" : \"Weight\",\n" + - " \"unit\" : \"kilogram\",\n" + - " \"value\" : 1.0\n" + - " } ]\n" + - " } ],\n" + - " \"onDiskPath\" : null\n" + - " } ]\n" + - "}"; - - DataObjectGroup og = si.getArchiveTransfer().getDataObjectPackage().getDogInDataObjectPackageIdMap().get("ID12"); + String testog = + "{\n" + + " \"binaryDataObjectList\" : [ {\n" + + " \"inDataObjectPackageId\" : \"ID13\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"BinaryMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Uri\",\n" + + " \"value\" : \"Content/ID13.txt\"\n" + + " }, {\n" + + " \"type\" : \"DigestType\",\n" + + " \"algorithm\" : \"SHA-512\",\n" + + " \"elementName\" : \"MessageDigest\",\n" + + " \"value\" : \"86c0bc701ef6b5dd21b080bc5bb2af38097baa6237275da83a52f092c9eae3e4e4b0247391620bd732fe824d18bd3bb6c37e62ec73a8cf3585c6a799399861b1\"\n" + + " }, {\n" + + " \"type\" : \"IntegerType\",\n" + + " \"elementName\" : \"Size\",\n" + + " \"value\" : 6\n" + + " }, {\n" + + " \"type\" : \"FormatIdentification\",\n" + + " \"elementName\" : \"FormatIdentification\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatLitteral\",\n" + + " \"value\" : \"Plain Text File\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"MimeType\",\n" + + " \"value\" : \"text/plain\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"FormatId\",\n" + + " \"value\" : \"x-fmt/111\"\n" + + " } ]\n" + + " }, {\n" + + " \"type\" : \"FileInfo\",\n" + + " \"elementName\" : \"FileInfo\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"Filename\",\n" + + " \"value\" : \"Montparnasse.txt\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"CreatingApplicationName\",\n" + + " \"value\" : \"CreatingApplicationName0\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"CreatingApplicationVersion\",\n" + + " \"value\" : \"CreatingApplicationVersion0\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"dateTimeString\" : \"2006-05-04T18:13:51\",\n" + + " \"elementName\" : \"DateCreatedByApplication\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"CreatingOs\",\n" + + " \"value\" : \"CreatingOs0\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"CreatingOsVersion\",\n" + + " \"value\" : \"CreatingOsVersion0\"\n" + + " }, {\n" + + " \"type\" : \"DateTimeType\",\n" + + " \"dateTimeString\" : \"2017-04-04T08:07:06.487+02:00\",\n" + + " \"elementName\" : \"LastModified\"\n" + + " } ]\n" + + " } ],\n" + + " \"onDiskPath\" : \"C:\\\\Users\\\\JS\\\\IdeaProjects\\\\sedatools\\\\sedalib\\\\target\\\\tmpJunit\\\\SipOK.zip-tmpdir\\\\Content\\\\ID13.txt\"\n" + + " } ],\n" + + " \"inDataObjectPackageId\" : \"ID12\",\n" + + " \"logBook\" : null,\n" + + " \"onDiskPath\" : null,\n" + + " \"physicalDataObjectList\" : [ {\n" + + " \"inDataObjectPackageId\" : \"ID1000\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"DataObjectVersion\",\n" + + " \"value\" : \"PhysicalMaster_1\"\n" + + " }, {\n" + + " \"type\" : \"StringType\",\n" + + " \"elementName\" : \"PhysicalId\",\n" + + " \"value\" : \"12345\"\n" + + " }, {\n" + + " \"type\" : \"PhysicalDimensions\",\n" + + " \"elementName\" : \"PhysicalDimensions\",\n" + + " \"metadataList\" : [ {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Height\",\n" + + " \"unit\" : \"centimetre\",\n" + + " \"value\" : 21.0\n" + + " }, {\n" + + " \"type\" : \"LinearDimensionType\",\n" + + " \"elementName\" : \"Length\",\n" + + " \"unit\" : \"centimetre\",\n" + + " \"value\" : 29.7\n" + + " }, {\n" + + " \"type\" : \"Weight\",\n" + + " \"elementName\" : \"Weight\",\n" + + " \"unit\" : \"kilogram\",\n" + + " \"value\" : 1.0\n" + + " } ]\n" + + " } ],\n" + + " \"onDiskPath\" : null\n" + + " } ]\n" + + "}"; + + DataObjectGroup og = si + .getArchiveTransfer() + .getDataObjectPackage() + .getDogInDataObjectPackageIdMap() + .get("ID12"); String sog = mapper.writeValueAsString(og); //System.out.println("Value to verify="+sog); Pattern pog = Pattern.compile("\"onDiskPath\" : .*\""); @@ -216,19 +223,20 @@ void TestSIPOKImport() throws Exception { assertThat(sog).isEqualToNormalizingNewlines(testog); // assert one archiveUnit using serialization - String testau = "{\n" + - " \"archiveUnitProfileXmlData\" : null,\n" + - " \"childrenAuList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ \"ID6\" ]\n" + - " },\n" + - " \"contentXmlData\" : \"\\n\\t\\t\\t\\t\\tRecordGrp\\n\\t\\t\\t\\t\\t1_Saint Denis Université (ligne 13)\\n\\t\\t\\t\\t 13.1.\\n\\t\\t\\t\\t RATP.13.1.\\n\\t\\t\\t\\t 123456\\n\\t\\t\\t\\t AZERTY\\n\\t\\t\\t\\t 20170045/1\\n\\t\\t\\t\\t AMN.X/12\\n\\t\\t\\t\\t 7890\\n\\t\\t\\t\\t QWERTY\\n\\t\\t\\t\\t Toto1\\n\\t\\t\\t\\t 1Otot\\n\\t\\t\\t\\t\\tCette ArchiveUnit n'a aucune règle propre, mais récupère du ManagementMetadata du SIP un NeedAuthorization à true, une StorageRule avec un FinalAction à Copy, une AppraisalRule avec un FinalAction à Keep, une AccessRule avec la Rule ACC-00002 dont la StartDate est 01/01/2000 et une ClassificationRule dont la Rule est CLASS-00001 avec pour StartDate 03/06/2015, Confidentiel Défense pour ClassificationLevel, ClassificationOwner0 pour ClassificationOwner, ClassificationAudience0 pour ClassificationAudience, 03/06/2016 comme ClassificationReassasingDate et un NeedReassessingAuthorization à true\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis - Université est une station de la ligne 13 du métro de Paris, située au nord de la commune de Saint-Denis, en limite de celle de Pierrefitte-sur-Seine, dans le département de la Seine-Saint-Denis. C'est le terminus de la ligne 13 sur sa branche nord-est\\n\\t\\t\\t\\t La station est ouverte le 25 mai 1998. Son nom vient de sa proximité immédiate de l'université de Paris VIII à Saint-Denis.\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Information de représentation\\n\\t\\t\\t\\t Plan\\n\\t\\t\\t\\t fr\\n\\t\\t\\t\\t fr\\n\\t\\t\\t\\t Original\\n\\t\\t\\t\\t 2\\n\\t\\t\\t\\t station\\n\\t\\t\\t\\t métropolitain\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Transport en commun\\n\\t\\t\\t\\t ark:/67717/T1-1273\\n\\t\\t\\t\\t subject\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis\\n\\t\\t\\t\\t 93066\\n\\t\\t\\t\\t geogname\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis\\n\\t\\t\\t\\t 20e siècle\\n\\t\\t\\t\\t Communauté de communes de Plaine Commune\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t RATP\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t RATP\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t

    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Compagnie du chemin de fer métropolitain de Paris\\n\\t\\t\\t\\t CMP\\n\\t\\t\\t\\t Transport\\n\\t\\t\\t\\t Transport en commun\\n\\t\\t\\t\\t Direction\\n\\t\\t\\t\\t Direction\\n\\t\\t\\t\\t Statuts de 1899\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Wikipedia\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID14\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID12\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 19850526/6\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 12345676890\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 4-LK18-3389\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-04-04T08:07:06\\n\\t\\t\\t\\t\\t2017-04-04T08:07:06\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 123456\\n\\t\\t\\t\\t Ligne_ouverture\\n\\t\\t\\t\\t Ouverture\\n\\t\\t\\t\\t 1998-05-25T08:07:06\\n\\t\\t\\t\\t Ouverture de la station à l'exploitation\\n\\t\\t\\t\\t OK\\n\\t\\t\\t\\t Ligne_Ouverture_OK\\n\\t\\t\\t\\t Ouverture de la station effectuée avec succès\\n\\t\\t\\t\\t 500 personnes présentes\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t 1998-04-04T08:07:06\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t 1998-04-04T08:07:06\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID13\\n\\t\\t\\t\\t 86c0bc701ef6b5dd21b080bc5bb2af38097baa6237275da83a52f092c9eae3e4e4b0247391620bd732fe824d18bd3bb6c37e62ec73a8cf3585c6a799399861b1\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Système géodésique WGS 84\\n\\t\\t\\t\\t 36\\n\\t\\t\\t\\t 0\\n\\t\\t\\t\\t 48 56 45.395\\n\\t\\t\\t\\t N\\n\\t\\t\\t\\t 2 21 49.964\\n\\t\\t\\t\\t E\\n\\t\\t\\t\\t 2018-03-01T11:04:00\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t\\tHiérarchique\\n\\t\\t\\t\\t\",\n" + - " \"dataObjectRefList\" : {\n" + - " \"inDataObjectPackageIdList\" : [ ]\n" + - " },\n" + - " \"inDataObjectPackageId\" : \"ID4\",\n" + - " \"managementXmlData\" : null,\n" + - " \"onDiskPath\" : null\n" + - "}"; + String testau = + "{\n" + + " \"archiveUnitProfileXmlData\" : null,\n" + + " \"childrenAuList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ \"ID6\" ]\n" + + " },\n" + + " \"contentXmlData\" : \"\\n\\t\\t\\t\\t\\tRecordGrp\\n\\t\\t\\t\\t\\t1_Saint Denis Université (ligne 13)\\n\\t\\t\\t\\t 13.1.\\n\\t\\t\\t\\t RATP.13.1.\\n\\t\\t\\t\\t 123456\\n\\t\\t\\t\\t AZERTY\\n\\t\\t\\t\\t 20170045/1\\n\\t\\t\\t\\t AMN.X/12\\n\\t\\t\\t\\t 7890\\n\\t\\t\\t\\t QWERTY\\n\\t\\t\\t\\t Toto1\\n\\t\\t\\t\\t 1Otot\\n\\t\\t\\t\\t\\tCette ArchiveUnit n'a aucune règle propre, mais récupère du ManagementMetadata du SIP un NeedAuthorization à true, une StorageRule avec un FinalAction à Copy, une AppraisalRule avec un FinalAction à Keep, une AccessRule avec la Rule ACC-00002 dont la StartDate est 01/01/2000 et une ClassificationRule dont la Rule est CLASS-00001 avec pour StartDate 03/06/2015, Confidentiel Défense pour ClassificationLevel, ClassificationOwner0 pour ClassificationOwner, ClassificationAudience0 pour ClassificationAudience, 03/06/2016 comme ClassificationReassasingDate et un NeedReassessingAuthorization à true\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis - Université est une station de la ligne 13 du métro de Paris, située au nord de la commune de Saint-Denis, en limite de celle de Pierrefitte-sur-Seine, dans le département de la Seine-Saint-Denis. C'est le terminus de la ligne 13 sur sa branche nord-est\\n\\t\\t\\t\\t La station est ouverte le 25 mai 1998. Son nom vient de sa proximité immédiate de l'université de Paris VIII à Saint-Denis.\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Information de représentation\\n\\t\\t\\t\\t Plan\\n\\t\\t\\t\\t fr\\n\\t\\t\\t\\t fr\\n\\t\\t\\t\\t Original\\n\\t\\t\\t\\t 2\\n\\t\\t\\t\\t station\\n\\t\\t\\t\\t métropolitain\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Transport en commun\\n\\t\\t\\t\\t ark:/67717/T1-1273\\n\\t\\t\\t\\t subject\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis\\n\\t\\t\\t\\t 93066\\n\\t\\t\\t\\t geogname\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Saint-Denis\\n\\t\\t\\t\\t 20e siècle\\n\\t\\t\\t\\t Communauté de communes de Plaine Commune\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t RATP\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t RATP\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Compagnie du chemin de fer métropolitain de Paris\\n\\t\\t\\t\\t CMP\\n\\t\\t\\t\\t Transport\\n\\t\\t\\t\\t Transport en commun\\n\\t\\t\\t\\t Direction\\n\\t\\t\\t\\t Direction\\n\\t\\t\\t\\t Statuts de 1899\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Wikipedia\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID14\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID12\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 19850526/6\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 12345676890\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 4-LK18-3389\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-01-01\\n\\t\\t\\t\\t 2017-04-04T08:07:06\\n\\t\\t\\t\\t\\t2017-04-04T08:07:06\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t 123456\\n\\t\\t\\t\\t Ligne_ouverture\\n\\t\\t\\t\\t Ouverture\\n\\t\\t\\t\\t 1998-05-25T08:07:06\\n\\t\\t\\t\\t Ouverture de la station à l'exploitation\\n\\t\\t\\t\\t OK\\n\\t\\t\\t\\t Ligne_Ouverture_OK\\n\\t\\t\\t\\t Ouverture de la station effectuée avec succès\\n\\t\\t\\t\\t 500 personnes présentes\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t 1998-04-04T08:07:06\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Fulgence Marie Auguste\\n\\t\\t\\t\\t Bienvenüe\\n\\t\\t\\t\\t Fulgence Marie Auguste Bienvenüe\\n\\t\\t\\t\\t Le père du métro\\n\\t\\t\\t\\t M\\n\\t\\t\\t\\t 1852-01-27\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t
    Place de la Mairie
    \\n\\t\\t\\t\\t 22460\\n\\t\\t\\t\\t Uzel\\n\\t\\t\\t\\t Bretagne\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t 1936-08-03\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t
    Hôpital Boucicaut
    \\n\\t\\t\\t\\t 75015\\n\\t\\t\\t\\t Paris\\n\\t\\t\\t\\t Ile de France\\n\\t\\t\\t\\t France\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t Française\\n\\t\\t\\t\\t 0000 0000 5488 9547\\n\\t\\t\\t\\t 1998-04-04T08:07:06\\n\\t\\t\\t\\t Ingénierie\\n\\t\\t\\t\\t Conception de lignes de métro\\n\\t\\t\\t\\t Chef de l'inspection des Ponts et Chaussées\\n\\t\\t\\t\\t Directeur des travaux\\n\\t\\t\\t\\t Loi du 30 mars 1898\\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t ID13\\n\\t\\t\\t\\t 86c0bc701ef6b5dd21b080bc5bb2af38097baa6237275da83a52f092c9eae3e4e4b0247391620bd732fe824d18bd3bb6c37e62ec73a8cf3585c6a799399861b1\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t
    \\n\\t\\t\\t\\t \\n\\t\\t\\t\\t Système géodésique WGS 84\\n\\t\\t\\t\\t 36\\n\\t\\t\\t\\t 0\\n\\t\\t\\t\\t 48 56 45.395\\n\\t\\t\\t\\t N\\n\\t\\t\\t\\t 2 21 49.964\\n\\t\\t\\t\\t E\\n\\t\\t\\t\\t 2018-03-01T11:04:00\\n\\t\\t\\t\\t \\n\\t\\t\\t\\t\\tHiérarchique\\n\\t\\t\\t\\t
    \",\n" + + " \"dataObjectRefList\" : {\n" + + " \"inDataObjectPackageIdList\" : [ ]\n" + + " },\n" + + " \"inDataObjectPackageId\" : \"ID4\",\n" + + " \"managementXmlData\" : null,\n" + + " \"onDiskPath\" : null\n" + + "}"; Pattern pau = Pattern.compile("\"onDiskPath\" : .*\""); Matcher mtestau = pau.matcher(testau); @@ -252,35 +260,34 @@ void TestSIPOKImport() throws Exception { // test decoding of complex management metadata on this ArchiveUnit au = si.getArchiveTransfer().getDataObjectPackage().getAuInDataObjectPackageIdMap().get("ID8"); - String testManagement = "\n" + - " \n" + - " STO-00001\n" + - " 2000-01-01\n" + - " Copy\n" + - " \n" + - " \n" + - " APP-00001\n" + - " 2001-01-01\n" + - " Destroy\n" + - " \n" + - " \n" + - " DIS-00001\n" + - " 2000-01-01\n" + - " \n" + - " \n" + - " REU-00001\n" + - " 2000-01-01\n" + - " \n" + - ""; + String testManagement = + "\n" + + " \n" + + " STO-00001\n" + + " 2000-01-01\n" + + " Copy\n" + + " \n" + + " \n" + + " APP-00001\n" + + " 2001-01-01\n" + + " Destroy\n" + + " \n" + + " \n" + + " DIS-00001\n" + + " 2000-01-01\n" + + " \n" + + " \n" + + " REU-00001\n" + + " 2000-01-01\n" + + " \n" + + ""; String management = au.getManagement().toString(); assertThat(management).isEqualToNormalizingNewlines(testManagement); - } @Test void TestSipWrongDogReferences() throws Exception { - // create jackson object mapper ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); @@ -291,7 +298,10 @@ void TestSipWrongDogReferences() throws Exception { mapper.enable(SerializationFeature.INDENT_OUTPUT); SIPToArchiveTransferImporter si = new SIPToArchiveTransferImporter( - "src/test/resources/PacketSamples/TestSipWrongDogReferences.zip", "target/tmpJunit/TestSipWrongDogReferences.zip-tmpdir", null); + "src/test/resources/PacketSamples/TestSipWrongDogReferences.zip", + "target/tmpJunit/TestSipWrongDogReferences.zip-tmpdir", + null + ); si.doImport(); ArchiveTransferToDiskExporter atde = new ArchiveTransferToDiskExporter(si.getArchiveTransfer(), null); @@ -340,6 +350,8 @@ void TestSipWrongDogReferences() throws Exception { assertEquals(gm1, gm2); - assertTrue(FileUtils.contentEquals(new File("target/tmpJunit/SWLMV2.1.xml"), new File("target/tmpJunit/SWLMV2.xml"))); + assertTrue( + FileUtils.contentEquals(new File("target/tmpJunit/SWLMV2.1.xml"), new File("target/tmpJunit/SWLMV2.xml")) + ); } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java index d46bed0d..ea554427 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/inout/importer/CSVMetadataFormatterTest.java @@ -52,18 +52,44 @@ class CSVMetadataFormatterTest { @Test void newCSVMetadataFormatter_tests_bad_headers() { - final String[] bad_row = {"One", "Two", "three"}; + final String[] bad_row = { "One", "Two", "three" }; Assertions.assertThrows(SEDALibException.class, () -> new CSVMetadataFormatter(bad_row, Paths.get("whatever"))); - String[] row_with_one_error = {"Id", "ParentId", "File", "ObjectFiles", "Content.DescriptionLevel", "Content.Title", "Content.Description", "Content.TransactedDate", "Content.StartDate", "CeaCategory"}; - Assertions.assertThrows(SEDALibException.class, () -> new CSVMetadataFormatter(row_with_one_error, Paths.get("whatever"))); + String[] row_with_one_error = { + "Id", + "ParentId", + "File", + "ObjectFiles", + "Content.DescriptionLevel", + "Content.Title", + "Content.Description", + "Content.TransactedDate", + "Content.StartDate", + "CeaCategory", + }; + Assertions.assertThrows( + SEDALibException.class, + () -> new CSVMetadataFormatter(row_with_one_error, Paths.get("whatever")) + ); } @Test void newCSVMetadataFormatter_test_OK() throws FileNotFoundException, SEDALibException { - String[] row = {"Id", "ParentId", "File", "ObjectFiles", "Content.DescriptionLevel", "Content.Title", "Content.Description", "Content.TransactedDate", "Content.StartDate"}; - CSVMetadataFormatter csvMetadataFormatter = new CSVMetadataFormatter(row, ResourceUtils.getResourcePath("metadata_OK.csv").getParent()); + String[] row = { + "Id", + "ParentId", + "File", + "ObjectFiles", + "Content.DescriptionLevel", + "Content.Title", + "Content.Description", + "Content.TransactedDate", + "Content.StartDate", + }; + CSVMetadataFormatter csvMetadataFormatter = new CSVMetadataFormatter( + row, + ResourceUtils.getResourcePath("metadata_OK.csv").getParent() + ); Assertions.assertTrue(csvMetadataFormatter.isExtendedFormat()); } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java index 0afd5733..65721bdb 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ArchiveUnitProfileTest.java @@ -49,7 +49,6 @@ class ArchiveUnitProfileTest { @Test void testConstructor() { - // Given ArchiveUnitProfile aup = new ArchiveUnitProfile("AUP-00001"); @@ -60,5 +59,4 @@ void testConstructor() { String testOut = "AUP-00001"; assertThat(out).isEqualTo(testOut); } - -} \ No newline at end of file +} diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java index d2aa651a..5a999fd3 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ContentTest.java @@ -62,7 +62,7 @@ class ContentTest { @Test - // Test Content and ComplexListType subclass + // Test Content and ComplexListType subclass void testConstructors() throws SEDALibException, FileNotFoundException { // Given Content content = new Content(); @@ -112,7 +112,13 @@ void testConstructors() throws SEDALibException, FileNotFoundException { Signature signature = new Signature(); signature.addNewMetadata("Signer", "Paul", "Dupont", LocalDateTime.of(1970, 1, 1, 1, 0)); signature.addNewMetadata("Signer", "Martin Durant", LocalDateTime.of(1970, 1, 2, 1, 0)); - signature.addNewMetadata("Signer", "Emilie", "Martin", LocalDateTime.of(1970, 1, 2, 1, 0), "emilie.martin@corp.fr"); + signature.addNewMetadata( + "Signer", + "Emilie", + "Martin", + LocalDateTime.of(1970, 1, 2, 1, 0), + "emilie.martin@corp.fr" + ); signature.addNewMetadata("Validator", "The corporation", LocalDateTime.of(1970, 1, 3, 1, 0)); signature.addNewMetadata("ReferencedObject", "TestID1", "TestDigest1", "TestSHA"); signature.addMetadata(signer); @@ -141,7 +147,7 @@ void testConstructors() throws SEDALibException, FileNotFoundException { // Test Keyword and KeywordType metadata Keyword keyword = new Keyword(); - EnumType keywordType = new EnumType("KeywordType","subject"); + EnumType keywordType = new EnumType("KeywordType", "subject"); keyword.addMetadata(keywordType); content.addMetadata(keyword); @@ -172,27 +178,29 @@ void testConstructors() throws SEDALibException, FileNotFoundException { content.addNewMetadata("XMLTest", "TestValue"); // Test free content import and automatic sorting in ComplexListType - content.addSedaXmlFragments(" Cerfa-1244771-ID10000\n" + - " 2104-05-13T00:00:00\n" + - " \n" + - " AUT-234452\n" + - " Autorisation\n" + - " 2104-05-31T01:00:00\n" + - " OK\n" + - " \n" + - " \n" + - " Rouge à laser\n" + - " Rubra Rana Laseri\n" + - " \n" + - " \n" + - " REF-16F14A19BF22\n" + - " Edouard\n" + - " AFINA\n" + - " \n" + - " \n" + - " Verte à détente\n" + - " Viridi Rana Elasticis\n" + - " "); + content.addSedaXmlFragments( + " Cerfa-1244771-ID10000\n" + + " 2104-05-13T00:00:00\n" + + " \n" + + " AUT-234452\n" + + " Autorisation\n" + + " 2104-05-31T01:00:00\n" + + " OK\n" + + " \n" + + " \n" + + " Rouge à laser\n" + + " Rubra Rana Laseri\n" + + " \n" + + " \n" + + " REF-16F14A19BF22\n" + + " Edouard\n" + + " AFINA\n" + + " \n" + + " \n" + + " Verte à détente\n" + + " Viridi Rana Elasticis\n" + + " " + ); String cOut = content.toString(); @@ -201,8 +209,9 @@ void testConstructors() throws SEDALibException, FileNotFoundException { String cNextOut = cNext.toString(); // Then - assertThat(cNextOut).isNotEqualToIgnoringWhitespace(ResourceUtils.getResourceAsString("metadata/content_01.xml")); - + assertThat(cNextOut).isNotEqualToIgnoringWhitespace( + ResourceUtils.getResourceAsString("metadata/content_01.xml") + ); } @Test @@ -228,8 +237,10 @@ void testFilteredCsvList() throws SEDALibException, FileNotFoundException { // Given List filter = Arrays.asList("Description", "Title", "Event", "Frog"); - Content content = (Content) Content.fromString(ResourceUtils.getResourceAsString("metadata/content_01.xml"), - Content.class); + Content content = (Content) Content.fromString( + ResourceUtils.getResourceAsString("metadata/content_01.xml"), + Content.class + ); // When the csv list is generated LinkedHashMap csvList = content.externToCsvList(filter); @@ -248,8 +259,10 @@ void testFilteredToString() throws SEDALibException, FileNotFoundException { // Given List filter = Arrays.asList("Description", "Title", "Event", "Frog"); - Content content = (Content) Content.fromString(ResourceUtils.getResourceAsString("metadata/content_01.xml"), - Content.class); + Content content = (Content) Content.fromString( + ResourceUtils.getResourceAsString("metadata/content_01.xml"), + Content.class + ); // When the csv list is generated String tmp = content.filteredToString(filter); @@ -258,7 +271,6 @@ void testFilteredToString() throws SEDALibException, FileNotFoundException { assertThat(tmp).isEqualTo(ResourceUtils.getResourceAsString("metadata/content_02.xml")); } - @Test void testSpecificMetadata() throws SEDALibException { // Given @@ -271,17 +283,18 @@ void testSpecificMetadata() throws SEDALibException { String cOut = c.toString(); // Then - String testOut = "\n" + - " \n" + - " TestKeywordContent\n" + - " \n" + - " \n" + - " TestLatitude\n" + - " N\n" + - " TestLongitude\n" + - " E\n" + - " \n" + - ""; + String testOut = + "\n" + + " \n" + + " TestKeywordContent\n" + + " \n" + + " \n" + + " TestLatitude\n" + + " N\n" + + " TestLongitude\n" + + " E\n" + + " \n" + + ""; assertThat(cOut).isEqualTo(testOut); } @@ -296,33 +309,34 @@ void testSeda2Version() throws SEDALibException { // and add Agent in SEDA 2.1 version then assertThatThrownBy(() -> c.addNewMetadata("Agent", "TestFirstName", "TestBirthName", "TestIdentifier")) - .isInstanceOf(SEDALibException.class).hasStackTraceContaining("Pas de constructeur de l'élément [Agent]"); + .isInstanceOf(SEDALibException.class) + .hasStackTraceContaining("Pas de constructeur de l'élément [Agent]"); // and add Agent in SEDA 2.1 version then SedaContext.setVersion(SedaVersion.V2_2); c.addNewMetadata("Agent", "TestFirstName", "TestBirthName", "TestIdentifier"); String cOut = c.toString(); - String testOut = "\n" + - " \n" + - " TestKeywordContent\n" + - " \n" + - " \n" + - " TestFirstName\n" + - " TestBirthName\n" + - " TestIdentifier\n" + - " \n" + - " \n" + - " TestLatitude\n" + - " N\n" + - " TestLongitude\n" + - " E\n" + - " \n" + - ""; + String testOut = + "\n" + + " \n" + + " TestKeywordContent\n" + + " \n" + + " \n" + + " TestFirstName\n" + + " TestBirthName\n" + + " TestIdentifier\n" + + " \n" + + " \n" + + " TestLatitude\n" + + " N\n" + + " TestLongitude\n" + + " E\n" + + " \n" + + ""; assertThat(cOut).isEqualTo(testOut); SedaContext.setVersion(SedaVersion.V2_1); } - @Test void testSomeExceptions() { // Given @@ -331,21 +345,26 @@ void testSomeExceptions() { // When loaded with all different kind of metadata //Test wrong args in addNewMetadata - assertThatThrownBy(() -> c.addNewMetadata("DescriptionLevel", "Test1", "Test2")) - .hasStackTraceContaining("Pas de constructeur"); // for StringType - assertThatThrownBy(() -> c.addNewMetadata("Description", "Test1", "Test2", "Test3")) - .hasStackTraceContaining("Pas de constructeur"); // for TextType - assertThatThrownBy(() -> c.addNewMetadata("Recipient", "Test", 1)) - .hasStackTraceContaining("Pas de constructeur"); // for AgentType - assertThatThrownBy(() -> c.addNewMetadata("XMLTest", new Date(0))) - .hasStackTraceContaining("Pas de constructeur"); // for GenericXMLBlock + assertThatThrownBy(() -> c.addNewMetadata("DescriptionLevel", "Test1", "Test2")).hasStackTraceContaining( + "Pas de constructeur" + ); // for StringType + assertThatThrownBy(() -> c.addNewMetadata("Description", "Test1", "Test2", "Test3")).hasStackTraceContaining( + "Pas de constructeur" + ); // for TextType + assertThatThrownBy(() -> c.addNewMetadata("Recipient", "Test", 1)).hasStackTraceContaining( + "Pas de constructeur" + ); // for AgentType + assertThatThrownBy(() -> c.addNewMetadata("XMLTest", new Date(0))).hasStackTraceContaining( + "Pas de constructeur" + ); // for GenericXMLBlock Event event = new Event(); - assertThatThrownBy(() -> event.addNewMetadata("EventDateTime", "Date")) - .hasStackTraceContaining("Impossible de construire"); // for DateTimeType + assertThatThrownBy(() -> event.addNewMetadata("EventDateTime", "Date")).hasStackTraceContaining( + "Impossible de construire" + ); // for DateTimeType // Test Keyword metadata with wrong KeywordType - assertThatThrownBy(() -> c.addNewMetadata("Keyword", "TestKeywordContent", "TestKeywordReference", "notconvenient")) - .hasStackTraceContaining("Impossible de construire l'élément [Keyword]"); - + assertThatThrownBy( + () -> c.addNewMetadata("Keyword", "TestKeywordContent", "TestKeywordReference", "notconvenient") + ).hasStackTraceContaining("Impossible de construire l'élément [Keyword]"); } @Test @@ -363,7 +382,13 @@ void testAddNewMetadata() throws SEDALibException, FileNotFoundException { Signature signature = new Signature(); signature.addNewMetadata("Signer", "TestFullName", LocalDateTime.of(1970, 1, 1, 1, 0)); signature.addNewMetadata("Signer", "TestFirstName", "TestBirthName", LocalDateTime.of(1970, 1, 1, 1, 0)); - signature.addNewMetadata("Signer", "TestFirstName", "TestBirthName", LocalDateTime.of(1970, 1, 1, 1, 0), "TestIdentifier"); + signature.addNewMetadata( + "Signer", + "TestFirstName", + "TestBirthName", + LocalDateTime.of(1970, 1, 1, 1, 0), + "TestIdentifier" + ); signature.addNewMetadata("Validator", "TestFullName", LocalDateTime.of(1970, 1, 1, 1, 0)); signature.addNewMetadata("ReferencedObject", "TestSystemID", "TestDigest"); content.addMetadata(signature); @@ -379,8 +404,13 @@ void testAddNewMetadata() throws SEDALibException, FileNotFoundException { // Test Event metadata content.addNewMetadata("Event", "TestEventIdentifier2", null, null, null); - content.addNewMetadata("Event", "TestEventIdentifier", "TestEventType", - LocalDateTime.of(1970, 1, 1, 1, 0), "TestOutcome"); + content.addNewMetadata( + "Event", + "TestEventIdentifier", + "TestEventType", + LocalDateTime.of(1970, 1, 1, 1, 0), + "TestOutcome" + ); // Test CustodialHistory metadata content.addNewMetadata("CustodialHistory", "TestItem1", "TestItem2", "TestItem3", "TestItem4"); @@ -419,27 +449,29 @@ void testAddNewMetadata() throws SEDALibException, FileNotFoundException { content.addNewMetadata("DescriptionLevel", "RecordGrp"); // verify that uniq metadata is overwritten // Test AnyXML and expandability - content.addSedaXmlFragments(" Cerfa-1244771-ID10000\n" + - " 2104-05-13T00:00:00\n" + - " \n" + - " AUT-234452\n" + - " Autorisation\n" + - " 2104-05-31T01:00:00\n" + - " OK\n" + - " \n" + - " \n" + - " Rouge à laser\n" + - " Rubra Rana Laseri\n" + - " \n" + - " \n" + - " REF-16F14A19BF22\n" + - " Edouard\n" + - " AFINA\n" + - " \n" + - " \n" + - " Verte à détente\n" + - " Viridi Rana Elasticis\n" + - " "); + content.addSedaXmlFragments( + " Cerfa-1244771-ID10000\n" + + " 2104-05-13T00:00:00\n" + + " \n" + + " AUT-234452\n" + + " Autorisation\n" + + " 2104-05-31T01:00:00\n" + + " OK\n" + + " \n" + + " \n" + + " Rouge à laser\n" + + " Rubra Rana Laseri\n" + + " \n" + + " \n" + + " REF-16F14A19BF22\n" + + " Edouard\n" + + " AFINA\n" + + " \n" + + " \n" + + " Verte à détente\n" + + " Viridi Rana Elasticis\n" + + " " + ); String cOut = content.toString(); diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java index 90cea929..6ab94b9a 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/DataTest.java @@ -60,11 +60,15 @@ class DataTest { @Test void testFileInfo() throws SEDALibException, FileNotFoundException { // Given - FileInfo fi = new FileInfo("TestFileName", "TestCreatingApplicationName", - "TestCreatingApplicationVersion", - LocalDateTime.parse("2006-05-04T18:13:51.0", ISO_DATE_TIME), - "TestCreatingOs", - "TestCreatingOsVersion", FileTime.fromMillis(0)); + FileInfo fi = new FileInfo( + "TestFileName", + "TestCreatingApplicationName", + "TestCreatingApplicationVersion", + LocalDateTime.parse("2006-05-04T18:13:51.0", ISO_DATE_TIME), + "TestCreatingOs", + "TestCreatingOsVersion", + FileTime.fromMillis(0) + ); String fiOut = fi.toString(); @@ -79,7 +83,12 @@ void testFileInfo() throws SEDALibException, FileNotFoundException { @Test void testFormatIdentification() throws SEDALibException { // Given - FormatIdentification fi = new FormatIdentification("TestFormatLitteral", "TestMimeType", "TestFormatId", "TestEncoding"); + FormatIdentification fi = new FormatIdentification( + "TestFormatLitteral", + "TestMimeType", + "TestFormatId", + "TestEncoding" + ); String fiOut = fi.toString(); @@ -88,12 +97,13 @@ void testFormatIdentification() throws SEDALibException { String fiNextOut = fiNext.toString(); //Then - String testOut = "\n" + - " TestFormatLitteral\n" + - " TestMimeType\n" + - " TestFormatId\n" + - " TestEncoding\n" + - ""; + String testOut = + "\n" + + " TestFormatLitteral\n" + + " TestMimeType\n" + + " TestFormatId\n" + + " TestEncoding\n" + + ""; assertThat(fiNextOut).isEqualTo(testOut); } @@ -135,14 +145,14 @@ void testMetadata() throws SEDALibException { String mNextOut = mNext.toString(); //Then - String testOut = "\n" + - " \n" + - " bad\n" + - ""; + String testOut = + "\n" + + " \n" + + " bad\n" + + ""; assertThat(mNextOut).isEqualTo(testOut); } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java index 464e68fb..8685b6ec 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementMetadataTest.java @@ -75,8 +75,12 @@ void testConstructors() throws SEDALibException { appraisalRule.setFinalAction("Keep"); mm.addMetadata(appraisalRule); mm.addNewMetadata("AppraisalRule", "TestAppRule2", null); - mm.addNewMetadata("HoldRule", "HoldRule1", LocalDate.of(1970, 1, 1), - Collections.singletonMap("HoldEndDate", LocalDate.of(1970, 1, 1))); + mm.addNewMetadata( + "HoldRule", + "HoldRule1", + LocalDate.of(1970, 1, 1), + Collections.singletonMap("HoldEndDate", LocalDate.of(1970, 1, 1)) + ); HoldRule holdRule = new HoldRule(); holdRule.addRule("HoldRule2"); holdRule.addHoldReason("HoldRule2Reason"); @@ -93,7 +97,8 @@ void testConstructors() throws SEDALibException { String mmNextOut = mmNext.toString(); // Then - String testOut = "\n" + + String testOut = + "\n" + " TestArchivalProfile\n" + " TestOriginatingAgencyIdentifier\n" + " TestSubmissionAgencyIdentifier\n" + diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java index f3f25e62..a671ef89 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/ManagementTest.java @@ -54,168 +54,173 @@ @ExtendWith(SedaContextExtension.class) class ManagementTest { - @Test - void testConstructors() throws SEDALibException, FileNotFoundException { - // Given - Management m = new Management(); - - // When loaded with all different kind of metadata - - // Test StorageRule and RuleType subclass newmetadata - StorageRule storageRule = new StorageRule("TestStoRule1",LocalDate.of(1970,1,1),"Transfer"); - m.addMetadata(storageRule); - - // Test AppraisalRule and RuleType subclass metadata add - AppraisalRule appraisalRule = new AppraisalRule(); - appraisalRule.addRule("TestAppRule1", LocalDate.of(1970,1,1)); - appraisalRule.setPreventInheritance(true); - appraisalRule.addRule("TestAppRule2"); - appraisalRule.addRefNonRuleId("TestAppRule3"); - appraisalRule.setFinalAction("Keep"); - m.addMetadata(appraisalRule); - - // Test AccessRule and RuleType subclass metadata add - AccessRule accessRule = new AccessRule(); - accessRule.addRule("TestAccRule1", LocalDate.of(1970,1,1)); - accessRule.setPreventInheritance(true); - accessRule.addRule("TestAccRule2"); - accessRule.addRefNonRuleId("TestAccRule3"); - m.addMetadata(accessRule); - - // Test DisseminationRule and RuleType subclass metadata add - DisseminationRule disseminationRule = new DisseminationRule(); - disseminationRule.addRule("TestDisRule1", LocalDate.of(1970,1,1)); - disseminationRule.setPreventInheritance(true); - disseminationRule.addRule("TestDisRule2"); - disseminationRule.addRefNonRuleId("TestDisRule3"); - m.addMetadata(disseminationRule); - - // Test ReuseRule and RuleType subclass metadata add - ReuseRule reuseRule = new ReuseRule(); - reuseRule.addRule("TestReuRule1", LocalDate.of(1970,1,1)); - reuseRule.setPreventInheritance(true); - reuseRule.addRule("TestReuRule2"); - reuseRule.addRefNonRuleId("TestReuRule3"); - m.addMetadata(reuseRule); - - // Test ClassificationRule and RuleType subclass metadata add - ClassificationRule classificationRule = new ClassificationRule(); - classificationRule.addRule("TestRule1", LocalDate.of(1970,1,1)); - classificationRule.setPreventInheritance(true); - classificationRule.addRule("TestRule2"); - classificationRule.addRefNonRuleId("TestRule3"); - classificationRule.addNewMetadata("ClassificationLevel","TestCD"); - classificationRule.addNewMetadata("ClassificationOwner","TestOwner"); - classificationRule.addNewMetadata("ClassificationReassessingDate",LocalDate.of(1970,1,1)); - classificationRule.addNewMetadata("NeedReassessingAuthorization",true); - m.addMetadata(classificationRule); - - // Test HoldRule and RuleType subclass metadata add - HoldRule holdRule = new HoldRule(); - holdRule.addRule("TestHoldRule1", LocalDate.of(1970, 1, 1)); - holdRule.addNewMetadata("HoldOwner", "TestHoldOwner1"); - holdRule.setPreventInheritance(true); - holdRule.addRule("TestHoldRule2"); - holdRule.addRefNonRuleId("TestHoldRule4"); - holdRule.addNewMetadata("HoldEndDate", LocalDate.of(1970, 1, 1)); - holdRule.addNewMetadata("HoldOwner", "TestHoldOwner2"); - holdRule.addNewMetadata("HoldReassessingDate", LocalDate.of(1970, 1, 1)); - holdRule.addNewMetadata("PreventRearrangement", false); - holdRule.addRule("TestHoldRule3"); - m.addMetadata(holdRule); - - // Test LogBook - LogBook logBook=new LogBook(); - logBook.addNewMetadata("Event","ID-00001","Request",LocalDateTime.of(2000,1,1,13,10),"OK"); - m.addMetadata(logBook); - - // Test GenerixXMLBlock - m.addNewMetadata("RawXML","Here"); - - // Test UpdateOperation - UpdateOperation updateOperation = new UpdateOperation("TestSystemId"); - m.addMetadata(updateOperation); - UpdateOperation updateOperation2 = new UpdateOperation("TestMetadataName", "TestMetadataValue"); // verify that uniq metadata is overwritten - m.addMetadata(updateOperation2); - - String mOut = m.toString(); - - // Test read write in XML string format - Management mNext = (Management) SEDAMetadata.fromString(mOut, Management.class); - String mNextOut = mNext.toString(); - - // Then + @Test + void testConstructors() throws SEDALibException, FileNotFoundException { + // Given + Management m = new Management(); + + // When loaded with all different kind of metadata + + // Test StorageRule and RuleType subclass newmetadata + StorageRule storageRule = new StorageRule("TestStoRule1", LocalDate.of(1970, 1, 1), "Transfer"); + m.addMetadata(storageRule); + + // Test AppraisalRule and RuleType subclass metadata add + AppraisalRule appraisalRule = new AppraisalRule(); + appraisalRule.addRule("TestAppRule1", LocalDate.of(1970, 1, 1)); + appraisalRule.setPreventInheritance(true); + appraisalRule.addRule("TestAppRule2"); + appraisalRule.addRefNonRuleId("TestAppRule3"); + appraisalRule.setFinalAction("Keep"); + m.addMetadata(appraisalRule); + + // Test AccessRule and RuleType subclass metadata add + AccessRule accessRule = new AccessRule(); + accessRule.addRule("TestAccRule1", LocalDate.of(1970, 1, 1)); + accessRule.setPreventInheritance(true); + accessRule.addRule("TestAccRule2"); + accessRule.addRefNonRuleId("TestAccRule3"); + m.addMetadata(accessRule); + + // Test DisseminationRule and RuleType subclass metadata add + DisseminationRule disseminationRule = new DisseminationRule(); + disseminationRule.addRule("TestDisRule1", LocalDate.of(1970, 1, 1)); + disseminationRule.setPreventInheritance(true); + disseminationRule.addRule("TestDisRule2"); + disseminationRule.addRefNonRuleId("TestDisRule3"); + m.addMetadata(disseminationRule); + + // Test ReuseRule and RuleType subclass metadata add + ReuseRule reuseRule = new ReuseRule(); + reuseRule.addRule("TestReuRule1", LocalDate.of(1970, 1, 1)); + reuseRule.setPreventInheritance(true); + reuseRule.addRule("TestReuRule2"); + reuseRule.addRefNonRuleId("TestReuRule3"); + m.addMetadata(reuseRule); + + // Test ClassificationRule and RuleType subclass metadata add + ClassificationRule classificationRule = new ClassificationRule(); + classificationRule.addRule("TestRule1", LocalDate.of(1970, 1, 1)); + classificationRule.setPreventInheritance(true); + classificationRule.addRule("TestRule2"); + classificationRule.addRefNonRuleId("TestRule3"); + classificationRule.addNewMetadata("ClassificationLevel", "TestCD"); + classificationRule.addNewMetadata("ClassificationOwner", "TestOwner"); + classificationRule.addNewMetadata("ClassificationReassessingDate", LocalDate.of(1970, 1, 1)); + classificationRule.addNewMetadata("NeedReassessingAuthorization", true); + m.addMetadata(classificationRule); + + // Test HoldRule and RuleType subclass metadata add + HoldRule holdRule = new HoldRule(); + holdRule.addRule("TestHoldRule1", LocalDate.of(1970, 1, 1)); + holdRule.addNewMetadata("HoldOwner", "TestHoldOwner1"); + holdRule.setPreventInheritance(true); + holdRule.addRule("TestHoldRule2"); + holdRule.addRefNonRuleId("TestHoldRule4"); + holdRule.addNewMetadata("HoldEndDate", LocalDate.of(1970, 1, 1)); + holdRule.addNewMetadata("HoldOwner", "TestHoldOwner2"); + holdRule.addNewMetadata("HoldReassessingDate", LocalDate.of(1970, 1, 1)); + holdRule.addNewMetadata("PreventRearrangement", false); + holdRule.addRule("TestHoldRule3"); + m.addMetadata(holdRule); + + // Test LogBook + LogBook logBook = new LogBook(); + logBook.addNewMetadata("Event", "ID-00001", "Request", LocalDateTime.of(2000, 1, 1, 13, 10), "OK"); + m.addMetadata(logBook); + + // Test GenerixXMLBlock + m.addNewMetadata("RawXML", "Here"); + + // Test UpdateOperation + UpdateOperation updateOperation = new UpdateOperation("TestSystemId"); + m.addMetadata(updateOperation); + UpdateOperation updateOperation2 = new UpdateOperation("TestMetadataName", "TestMetadataValue"); // verify that uniq metadata is overwritten + m.addMetadata(updateOperation2); + + String mOut = m.toString(); + + // Test read write in XML string format + Management mNext = (Management) SEDAMetadata.fromString(mOut, Management.class); + String mNextOut = mNext.toString(); + + // Then String testOut = ResourceUtils.getResourceAsString("metadata/metadate_out.xml"); - assertThat(mNextOut).isEqualToIgnoringWhitespace(testOut); - } - - @Test - void testAddNewMetadata() throws SEDALibException { - // Given - Management m = new Management(); - - // When loaded with all different kind of metadata - - // Test RuleType subclass metadata add - m.addNewMetadata("AccessRule","TestAccessRule",LocalDate.of(1970,1,1)); - m.addNewMetadata("AppraisalRule","TestAppraisalRule",LocalDate.of(1970,1,1)); // no value in result - m.addNewMetadata("AppraisalRule","TestAppraisalRule",LocalDate.of(1970,1,1),"Keep"); - m.addNewMetadata("ClassificationRule","TestLevel","TestOwner"); - m.addNewMetadata("DisseminationRule","TestDisseminationRule",LocalDate.of(1970,1,1)); - m.addNewMetadata("ReuseRule","TestReuseRule",LocalDate.of(1970,1,1)); - m.addNewMetadata("StorageRule","TestStorageRule",LocalDate.of(1970,1,1),"Copy"); - m.addNewMetadata("HoldRule", "TestHoldRule", LocalDate.of(1970, 1, 1), - Collections.singletonMap("HoldEndDate", LocalDate.of(1970, 1, 1))); - - // Test UpdateOperation - m.addNewMetadata("UpdateOperation","TestMetadataName","TestMetadataValue"); - - String mOut = m.toString(); - - // Test read write in XML string format - Management mNext = (Management) SEDAMetadata.fromString(mOut, Management.class); - String mNextOut = mNext.toString(); - - // Then - String testOut = "\n" + - " \n" + - " TestStorageRule\n" + - " 1970-01-01\n" + - " Copy\n" + - " \n" + - " \n" + - " TestAppraisalRule\n" + - " 1970-01-01\n" + - " Keep\n" + - " \n" + - " \n" + - " TestAccessRule\n" + - " 1970-01-01\n" + - " \n" + - " \n" + - " TestDisseminationRule\n" + - " 1970-01-01\n" + - " \n" + - " \n" + - " TestReuseRule\n" + - " 1970-01-01\n" + - " \n" + - " \n" + - " TestLevel\n" + - " TestOwner\n" + - " \n" + - " \n" + - " TestHoldRule\n" + - " 1970-01-01\n" + - " 1970-01-01\n" + - " \n" + - " \n" + - " \n" + - " TestMetadataName\n" + - " TestMetadataValue\n" + - " \n" + - " \n" + - ""; - assertThat(mNextOut).isEqualTo(testOut); - } + assertThat(mNextOut).isEqualToIgnoringWhitespace(testOut); + } + + @Test + void testAddNewMetadata() throws SEDALibException { + // Given + Management m = new Management(); + + // When loaded with all different kind of metadata + + // Test RuleType subclass metadata add + m.addNewMetadata("AccessRule", "TestAccessRule", LocalDate.of(1970, 1, 1)); + m.addNewMetadata("AppraisalRule", "TestAppraisalRule", LocalDate.of(1970, 1, 1)); // no value in result + m.addNewMetadata("AppraisalRule", "TestAppraisalRule", LocalDate.of(1970, 1, 1), "Keep"); + m.addNewMetadata("ClassificationRule", "TestLevel", "TestOwner"); + m.addNewMetadata("DisseminationRule", "TestDisseminationRule", LocalDate.of(1970, 1, 1)); + m.addNewMetadata("ReuseRule", "TestReuseRule", LocalDate.of(1970, 1, 1)); + m.addNewMetadata("StorageRule", "TestStorageRule", LocalDate.of(1970, 1, 1), "Copy"); + m.addNewMetadata( + "HoldRule", + "TestHoldRule", + LocalDate.of(1970, 1, 1), + Collections.singletonMap("HoldEndDate", LocalDate.of(1970, 1, 1)) + ); + + // Test UpdateOperation + m.addNewMetadata("UpdateOperation", "TestMetadataName", "TestMetadataValue"); + + String mOut = m.toString(); + + // Test read write in XML string format + Management mNext = (Management) SEDAMetadata.fromString(mOut, Management.class); + String mNextOut = mNext.toString(); + + // Then + String testOut = + "\n" + + " \n" + + " TestStorageRule\n" + + " 1970-01-01\n" + + " Copy\n" + + " \n" + + " \n" + + " TestAppraisalRule\n" + + " 1970-01-01\n" + + " Keep\n" + + " \n" + + " \n" + + " TestAccessRule\n" + + " 1970-01-01\n" + + " \n" + + " \n" + + " TestDisseminationRule\n" + + " 1970-01-01\n" + + " \n" + + " \n" + + " TestReuseRule\n" + + " 1970-01-01\n" + + " \n" + + " \n" + + " TestLevel\n" + + " TestOwner\n" + + " \n" + + " \n" + + " TestHoldRule\n" + + " 1970-01-01\n" + + " 1970-01-01\n" + + " \n" + + " \n" + + " \n" + + " TestMetadataName\n" + + " TestMetadataValue\n" + + " \n" + + " \n" + + ""; + assertThat(mNextOut).isEqualTo(testOut); + } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java index 925d47d7..36cdcb4d 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/metadata/namedtype/DateTimeTypeTest.java @@ -49,7 +49,9 @@ public class DateTimeTypeTest { // --- Precise formats --- @Test - @DisplayName("Should recognise an OFFSET_DATE_TIME with explicit timezone offset (+02:00) and produce the correct UTC date") + @DisplayName( + "Should recognise an OFFSET_DATE_TIME with explicit timezone offset (+02:00) and produce the correct UTC date" + ) void testOffsetDateTime() { String input = "2025-10-28T14:30:15+02:00"; DateTimeType dtt = new DateTimeType("Test", input); @@ -175,9 +177,8 @@ void toLocalDateTime_givenOffsetDateTime_shouldReturnLocalDateTimeWithSystemOffs LocalDateTime result = dt.toLocalDateTime(); assertNotNull(result, "Expected non-null LocalDateTime for OFFSET_DATE_TIME"); // Conversion UTC -> system LocalDateTime - LocalDateTime expectedLocal = ((OffsetDateTime) dt.getTemporalValue()) - .atZoneSameInstant(ZoneId.systemDefault()) - .toLocalDateTime(); + LocalDateTime expectedLocal = + ((OffsetDateTime) dt.getTemporalValue()).atZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); assertEquals(expectedLocal, result, "LocalDateTime must match system local time"); } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java index 2609ae4e..b0e61547 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/CompactorTest.java @@ -63,26 +63,31 @@ class CompactorTest implements UseTestFiles { private void eraseAll(String dirOrFile) { try { Files.delete(Paths.get(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { FileUtils.deleteDirectory(new File(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } @Test void TestCompactor() throws Exception { - // Given this test directory imported DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", null); + "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); di.doImport(); // When Compact the root ArchiveUnit - ArchiveUnit rootAu = di.getArchiveTransfer().getDataObjectPackage().getGhostRootAu().getChildrenAuList().getArchiveUnitList().get(0); + ArchiveUnit rootAu = di + .getArchiveTransfer() + .getDataObjectPackage() + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList() + .get(0); eraseAll("target/tmpJunit/CompactorTest"); Compactor compactor = new Compactor(rootAu, "target/tmpJunit/CompactorTest", null); compactor.setObjectVersionFilters(List.of("BinaryMaster"), List.of("BinaryMaster", "TextContent")); @@ -101,9 +106,13 @@ void TestCompactor() throws Exception { // And assert the first DocumentPack AU content ArchiveUnit packAU = compactedAU.getChildrenAuList().getArchiveUnitList().get(0); - assertThat(TestUtilities.SlackNormalize(packAU.getContentXmlData().replaceAll(".+<\\/LastModified>", - "###TIMESTAMP###<\\/LastModified>"))) - .isEqualTo(ResourceUtils.getResourceAsString("import/AU_ID2.xml")); + assertThat( + TestUtilities.SlackNormalize( + packAU + .getContentXmlData() + .replaceAll(".+<\\/LastModified>", "###TIMESTAMP###<\\/LastModified>") + ) + ).isEqualTo(ResourceUtils.getResourceAsString("import/AU_ID2.xml")); // And assert created files File doc = new File("target/tmpJunit/CompactorTest/Document1.zip"); @@ -118,20 +127,31 @@ void TestCompactor() throws Exception { @Test void TestCompactorSeda2V3() throws Exception { - // Given this test directory imported SedaContext.setVersion(SedaVersion.V2_3); DiskToArchiveTransferImporter di = new DiskToArchiveTransferImporter( - "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", null); + "src/test/resources/PacketSamples/SampleWithoutLinksModelV1", + null + ); di.addIgnorePattern("Thumbs.db"); di.addIgnorePattern("pagefile.sys"); di.doImport(); // When Compact the root ArchiveUnit - ArchiveUnit rootAu = di.getArchiveTransfer().getDataObjectPackage().getGhostRootAu().getChildrenAuList().getArchiveUnitList().get(0); - BinaryDataObject bdo=di.getArchiveTransfer().getDataObjectPackage().getBdoInDataObjectPackageIdMap().get("ID18"); - bdo.addNewMetadata("DataObjectUse","BinaryMaster"); - bdo.addNewMetadata("DataObjectNumber",1); + ArchiveUnit rootAu = di + .getArchiveTransfer() + .getDataObjectPackage() + .getGhostRootAu() + .getChildrenAuList() + .getArchiveUnitList() + .get(0); + BinaryDataObject bdo = di + .getArchiveTransfer() + .getDataObjectPackage() + .getBdoInDataObjectPackageIdMap() + .get("ID18"); + bdo.addNewMetadata("DataObjectUse", "BinaryMaster"); + bdo.addNewMetadata("DataObjectNumber", 1); eraseAll("target/tmpJunit/CompactorTest"); Compactor compactor = new Compactor(rootAu, "target/tmpJunit/CompactorTest", null); compactor.setObjectVersionFilters(List.of("BinaryMaster"), List.of("BinaryMaster", "TextContent")); @@ -142,8 +162,12 @@ void TestCompactorSeda2V3() throws Exception { // Then assert the first DocumentPack AU content ArchiveUnit packAU = compactedAU.getChildrenAuList().getArchiveUnitList().get(0); - assertThat(TestUtilities.SlackNormalize(packAU.getContentXmlData().replaceAll(".+<\\/LastModified>", - "###TIMESTAMP###<\\/LastModified>"))) - .isEqualTo(ResourceUtils.getResourceAsString("import/AU_ID2V3.xml")); + assertThat( + TestUtilities.SlackNormalize( + packAU + .getContentXmlData() + .replaceAll(".+<\\/LastModified>", "###TIMESTAMP###<\\/LastModified>") + ) + ).isEqualTo(ResourceUtils.getResourceAsString("import/AU_ID2V3.xml")); } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java index 7134d911..a994caed 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/process/DeCompactorTest.java @@ -64,18 +64,17 @@ class DeCompactorTest implements UseTestFiles { private void eraseAll(String dirOrFile) { try { Files.delete(Paths.get(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} try { FileUtils.deleteDirectory(new File(dirOrFile)); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } /** * The Sort by title tool. */ static class SortByTitle implements Comparator { + public int compare(ArchiveUnit a, ArchiveUnit b) { String titleA = null; String titleB = null; @@ -88,8 +87,7 @@ public int compare(ArchiveUnit a, ArchiveUnit b) { return titleA.compareTo(titleB); } - public SortByTitle() { - } + public SortByTitle() {} } private void sortDataObjectPackage(DataObjectPackage dataObjectPackage) { @@ -100,45 +98,50 @@ private void sortDataObjectPackage(DataObjectPackage dataObjectPackage) { Collections.sort(dataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList(), sortByTitle); } - private String removeLines(String s, int number){ + private String removeLines(String s, int number) { String[] lines = s.split("\\R"); List linelist = new ArrayList<>(lines.length); - for (int i=number;i\n" + - " Acquisition Information\n" + - " Public Archive\n" + - " Service_producteur\n" + - " Service_versant\n" + - " "); + dataObjectPackage.setManagementMetadataXmlData( + " \n" + + " Acquisition Information\n" + + " Public Archive\n" + + " Service_producteur\n" + + " Service_versant\n" + + " " + ); sortDataObjectPackage(dataObjectPackage); dataObjectPackage.regenerateContinuousIds(); Management management = dataObjectPackage.getArchiveUnitById("ID11").getManagement(); dataObjectPackage.getArchiveUnitById("ID11").setManagement(null); dataObjectPackage.getArchiveUnitById("ID10").setManagement(management); - String originManifestString = removeLines(sm.getSEDAXMLManifest(true, true),2); + String originManifestString = removeLines(sm.getSEDAXMLManifest(true, true), 2); Map originBinaryMap = Map.copyOf(dataObjectPackage.getBdoInDataObjectPackageIdMap()); // When compact the root ArchiveUnit and decompact it ArchiveUnit rootAu = dataObjectPackage.getGhostRootAu().getChildrenAuList().getArchiveUnitList().get(0); eraseAll("target/tmpJunit/CompactorTest"); Compactor compactor = new Compactor(rootAu, "target/tmpJunit/CompactorTest", null); - compactor.setObjectVersionFilters(List.of("BinaryMaster", "TextContent"), List.of("BinaryMaster", "TextContent")); + compactor.setObjectVersionFilters( + List.of("BinaryMaster", "TextContent"), + List.of("BinaryMaster", "TextContent") + ); compactor.setCompactedDocumentPackLimit(4096, 4); compactor.setDeflatedFlag(true); ArchiveUnit compactedAU = compactor.doCompact(); @@ -149,7 +152,7 @@ void TestDeCompactor() throws Exception { ArchiveUnit decompactedAU = decompactor.doDeCompact(); sortDataObjectPackage(dataObjectPackage); dataObjectPackage.regenerateContinuousIds(); - String destManifestString = removeLines(sm.getSEDAXMLManifest(true, true),2); + String destManifestString = removeLines(sm.getSEDAXMLManifest(true, true), 2); // Then assert that // - there are only 2 ArchiveUnits in compacted version @@ -159,11 +162,14 @@ void TestDeCompactor() throws Exception { // - a Management has been kept assertThat(destManifestString).contains(""); // - there are the same number of BinaryDataObjects that in origin, and that all have the same size on disk - assertThat(dataObjectPackage.getBdoInDataObjectPackageIdMap().size()) - .isEqualTo(originBinaryMap.size()); + assertThat(dataObjectPackage.getBdoInDataObjectPackageIdMap().size()).isEqualTo(originBinaryMap.size()); for (Map.Entry e : dataObjectPackage.getBdoInDataObjectPackageIdMap().entrySet()) { File originBinary = e.getValue().getOnDiskPath().toFile(); - File newBinary = dataObjectPackage.getBdoInDataObjectPackageIdMap().get(e.getKey()).getOnDiskPath().toFile(); + File newBinary = dataObjectPackage + .getBdoInDataObjectPackageIdMap() + .get(e.getKey()) + .getOnDiskPath() + .toFile(); assertThat(originBinary.length()).isEqualTo(newBinary.length()); } } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java index 3481da76..9a8825dd 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ArchTests.java @@ -53,27 +53,34 @@ @ExtendWith(SedaContextExtension.class) public class ArchTests { - @Test @Disabled("Only for research purpose") public void testStaticMethodsOfLocalDateTime() { JavaClasses importedClasses = new ClassFileImporter().importPackages("fr.gouv.vitam"); ArchRuleDefinition.noClasses() - .that() - .doNotHaveFullyQualifiedName(LocalDateTimeUtil.class.getName()) - .should() - .callMethodWhere( - new DescribedPredicate<>("static methods of LocalDateTime are invoked instead of LocalDateUtil helpers") { - @Override - public boolean test(JavaMethodCall javaMethodCall) { - return javaMethodCall.getTargetOwner().getFullName().equals(LocalDateTime.class.getName()) - && javaMethodCall.getTarget().resolveMember().orElseThrow() - .getModifiers().contains(JavaModifier.STATIC); - } - } - ) - .check(importedClasses); + .that() + .doNotHaveFullyQualifiedName(LocalDateTimeUtil.class.getName()) + .should() + .callMethodWhere( + new DescribedPredicate<>( + "static methods of LocalDateTime are invoked instead of LocalDateUtil helpers" + ) { + @Override + public boolean test(JavaMethodCall javaMethodCall) { + return ( + javaMethodCall.getTargetOwner().getFullName().equals(LocalDateTime.class.getName()) && + javaMethodCall + .getTarget() + .resolveMember() + .orElseThrow() + .getModifiers() + .contains(JavaModifier.STATIC) + ); + } + } + ) + .check(importedClasses); } @Test @@ -81,20 +88,23 @@ public void forbidden_LocalDateTime_toString_format() { JavaClasses importedClasses = new ClassFileImporter().importPackages("fr.gouv.vitam"); ArchRuleDefinition.noClasses() - .that() - .doNotHaveFullyQualifiedName(LocalDateTimeUtil.class.getName()) - .should() - .callMethodWhere( - new DescribedPredicate<>("LocalDateTime.toString is invoked instead of LocalDateTimeUtil.getFormattedDateTime") { - @Override - public boolean test(JavaMethodCall javaMethodCall) { - return javaMethodCall.getTargetOwner().getFullName().equals(LocalDateTime.class.getName()) - && (javaMethodCall.getTarget().getName().equals("toString") - || javaMethodCall.getTarget().getName().equals("format")); - } - } - ) - .check(importedClasses); + .that() + .doNotHaveFullyQualifiedName(LocalDateTimeUtil.class.getName()) + .should() + .callMethodWhere( + new DescribedPredicate<>( + "LocalDateTime.toString is invoked instead of LocalDateTimeUtil.getFormattedDateTime" + ) { + @Override + public boolean test(JavaMethodCall javaMethodCall) { + return ( + javaMethodCall.getTargetOwner().getFullName().equals(LocalDateTime.class.getName()) && + (javaMethodCall.getTarget().getName().equals("toString") || + javaMethodCall.getTarget().getName().equals("format")) + ); + } + } + ) + .check(importedClasses); } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java index 91dc5c18..d5abcd1a 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/LocalDateTimeUtilTest.java @@ -52,12 +52,11 @@ @ExtendWith(SedaContextExtension.class) class LocalDateTimeUtilTest { - @Test public void parseDateTime_tests() { assertEquals( - LocalDateTime.of(2024, 12, 25, 0, 0, 0), - LocalDateTimeUtil.parseDateTime("2024-12-25T00:00:00.000000000") + LocalDateTime.of(2024, 12, 25, 0, 0, 0), + LocalDateTimeUtil.parseDateTime("2024-12-25T00:00:00.000000000") ); assertEquals(LocalDateTime.of(2024, 12, 25, 0, 0, 0), LocalDateTimeUtil.parseDateTime("2024-12-25T00:00:00")); assertEquals(LocalDateTime.of(2024, 12, 25, 0, 0, 0), LocalDateTimeUtil.parseDateTime("2024-12-25T00:00")); @@ -65,43 +64,49 @@ public void parseDateTime_tests() { assertThrows(DateTimeParseException.class, () -> LocalDateTimeUtil.parseDateTime("2024-12-25T")); assertEquals(LocalDateTime.of(2024, 12, 25, 0, 0, 0), LocalDateTimeUtil.parseDateTime("2024-12-25")); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456789), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123456789") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456789), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123456789") + ); + assertEquals( + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456780), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12345678") + ); + assertEquals( + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456700), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1234567") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456780), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12345678") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123456") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456700), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1234567") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123450000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12345") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123456000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123456") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123400000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1234") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123450000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12345") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123400000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1234") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 120000000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.123") + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 100000000), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 120000000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.12") + LocalDateTime.of(2024, 12, 25, 12, 34, 56), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.") ); assertEquals( - LocalDateTime.of(2024, 12, 25, 12, 34, 56, 100000000), - LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.1") + LocalDateTime.of(2024, 12, 25, 12, 34, 56), + LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56") ); - assertEquals(LocalDateTime.of(2024, 12, 25, 12, 34, 56), LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56.")); - assertEquals(LocalDateTime.of(2024, 12, 25, 12, 34, 56), LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:56")); assertThrows(DateTimeParseException.class, () -> LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:5")); assertThrows(DateTimeParseException.class, () -> LocalDateTimeUtil.parseDateTime("2024-12-25T12:34:")); assertEquals(LocalDateTime.of(2024, 12, 25, 12, 34, 0), LocalDateTimeUtil.parseDateTime("2024-12-25T12:34")); @@ -125,57 +130,66 @@ public void getFormattedDateTime_String_tests() { assertEquals("2024-12-25T12:34:56.000", LocalDateTimeUtil.getFormattedDateTime("2024-12-25T12:34:56PST")); assertEquals("2024-12-25T12:34:56.120", LocalDateTimeUtil.getFormattedDateTime("2024-12-25T12:34:56.12")); assertEquals("2024-12-25T12:34:56.123", LocalDateTimeUtil.getFormattedDateTime("2024-12-25T12:34:56.123Z")); - assertEquals("2024-12-25T12:34:56.123", LocalDateTimeUtil.getFormattedDateTime("2024-12-25T12:34:56.123PST") - ); + assertEquals("2024-12-25T12:34:56.123", LocalDateTimeUtil.getFormattedDateTime("2024-12-25T12:34:56.123PST")); } @Test public void getFormattedDateTime_LocalDateTime_tests() { assertEquals( - "2024-12-25T12:34:56.123", - LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000)) + "2024-12-25T12:34:56.123", + LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000)) ); assertEquals( - "2024-12-25T12:34:56.000", - LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 0)) + "2024-12-25T12:34:56.000", + LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 0)) ); assertEquals( - "2024-12-25T12:34:00.000", - LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 0, 0)) + "2024-12-25T12:34:00.000", + LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 34, 0, 0)) ); assertEquals( - "2024-12-25T12:00:00.000", - LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 0, 0, 0)) + "2024-12-25T12:00:00.000", + LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 12, 0, 0, 0)) ); assertEquals( - "2024-12-25T00:00:00.000", - LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 0, 0, 0, 0)) + "2024-12-25T00:00:00.000", + LocalDateTimeUtil.getFormattedDateTime(LocalDateTime.of(2024, 12, 25, 0, 0, 0, 0)) ); } - @Test public void getFormattedDateTime_FileTime_tests() { assertEquals( - "2024-12-25T12:34:56.123", - LocalDateTimeUtil.getFormattedDateTime(FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000).atZone(ZoneId.systemDefault()).toInstant())) + "2024-12-25T12:34:56.123", + LocalDateTimeUtil.getFormattedDateTime( + FileTime.from( + LocalDateTime.of(2024, 12, 25, 12, 34, 56, 123000000).atZone(ZoneId.systemDefault()).toInstant() + ) + ) ); assertEquals( - "2024-12-25T12:34:56.000", - LocalDateTimeUtil.getFormattedDateTime(FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 0).atZone(ZoneId.systemDefault()).toInstant())) + "2024-12-25T12:34:56.000", + LocalDateTimeUtil.getFormattedDateTime( + FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 34, 56, 0).atZone(ZoneId.systemDefault()).toInstant()) + ) ); assertEquals( - "2024-12-25T12:34:00.000", - LocalDateTimeUtil.getFormattedDateTime(FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 34, 0, 0).atZone(ZoneId.systemDefault()).toInstant())) + "2024-12-25T12:34:00.000", + LocalDateTimeUtil.getFormattedDateTime( + FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 34, 0, 0).atZone(ZoneId.systemDefault()).toInstant()) + ) ); assertEquals( - "2024-12-25T12:00:00.000", - LocalDateTimeUtil.getFormattedDateTime(FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant())) + "2024-12-25T12:00:00.000", + LocalDateTimeUtil.getFormattedDateTime( + FileTime.from(LocalDateTime.of(2024, 12, 25, 12, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()) + ) ); assertEquals( - "2024-12-25T00:00:00.000", - LocalDateTimeUtil.getFormattedDateTime(FileTime.from(LocalDateTime.of(2024, 12, 25, 0, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant())) + "2024-12-25T00:00:00.000", + LocalDateTimeUtil.getFormattedDateTime( + FileTime.from(LocalDateTime.of(2024, 12, 25, 0, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()) + ) ); } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java index 882fbfe2..4ff19963 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/utils/ResourceUtils.java @@ -72,13 +72,13 @@ public static InputStream getResourceAsStream(String resourcesFile) throws FileN try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { - throw new FileNotFoundException( SECURITY_IN_RESOURCES + resourcesFile); + throw new FileNotFoundException(SECURITY_IN_RESOURCES + resourcesFile); } if (stream == null) { try { stream = ResourceUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { - throw new FileNotFoundException( SECURITY_IN_RESOURCES + resourcesFile); + throw new FileNotFoundException(SECURITY_IN_RESOURCES + resourcesFile); } } if (stream == null) { @@ -87,7 +87,6 @@ public static InputStream getResourceAsStream(String resourcesFile) throws FileN return stream; } - /** * Get the File representation from the local path to the Resources directory * @@ -149,11 +148,10 @@ public static String getResourceAsString(String resourcesFile) throws FileNotFou try { fileAsString = new String(Files.readAllBytes(getResourcePath(resourcesFile))); } catch (final SecurityException e) { - throw new FileNotFoundException( SECURITY_IN_RESOURCES + resourcesFile); + throw new FileNotFoundException(SECURITY_IN_RESOURCES + resourcesFile); } catch (final IOException e) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return fileAsString; } - } diff --git a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java index 734e47ed..37b73a18 100644 --- a/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java +++ b/sedalib/src/test/java/fr/gouv/vitam/tools/sedalib/xml/SEDAValidationTest.java @@ -52,7 +52,6 @@ public class SEDAValidationTest { @Test public void testSeda2_1ArchiveTransferCompliance() throws SEDALibException { - // Given String sedaFilePath = "src/test/resources/xml/seda2_1ArchiveTransfer.xml"; // Modify with actual path SedaContext.setVersion(SedaVersion.V2_1); @@ -65,6 +64,5 @@ public void testSeda2_1ArchiveTransferCompliance() throws SEDALibException { // Then assertThat(isValid).as("Validation process on SEDA 2.1 failed").isTrue(); } - // TODO test seda 2.2 et 2.3 } diff --git a/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java b/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java index 8f592dc7..bc33c80c 100644 --- a/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java +++ b/testsipgenerator/src/main/java/fr/gouv/vitam/tools/testsipgenerator/TestSipGeneratorApp.java @@ -37,28 +37,6 @@ */ package fr.gouv.vitam.tools.testsipgenerator; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.attribute.FileTime; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Formatter; -import java.util.List; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.HelpFormatter; -import org.apache.commons.cli.Option; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.LoggerFactory; - import fr.gouv.vitam.tools.sedalib.core.ArchiveUnit; import fr.gouv.vitam.tools.sedalib.core.BinaryDataObject; import fr.gouv.vitam.tools.sedalib.inout.SIPBuilder; @@ -66,12 +44,32 @@ import fr.gouv.vitam.tools.sedalib.metadata.data.FileInfo; import fr.gouv.vitam.tools.sedalib.metadata.data.FormatIdentification; import fr.gouv.vitam.tools.sedalib.metadata.namedtype.DigestType; -import fr.gouv.vitam.tools.sedalib.metadata.namedtype.IntegerType; import fr.gouv.vitam.tools.sedalib.metadata.namedtype.StringType; import fr.gouv.vitam.tools.sedalib.utils.SEDALibException; import fr.gouv.vitam.tools.sedalib.utils.SEDALibProgressLogger; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.LoggerFactory; import uk.gov.nationalarchives.droid.core.interfaces.IdentificationResult; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.FileTime; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Formatter; +import java.util.List; + /** * TestSipGeneratorApp class for launching the command. * @@ -81,9 +79,9 @@ public class TestSipGeneratorApp { - final static int ZERO_CONTENT = 0; - final static int TEXT_CONTENT = 1; - final static int RANDOM_CONTENT = 2; + static final int ZERO_CONTENT = 0; + static final int TEXT_CONTENT = 1; + static final int RANDOM_CONTENT = 2; static Options options; static CommandLineParser parser = new DefaultParser(); @@ -117,57 +115,91 @@ static Options createOptions() { Option help = new Option("h", "help", false, "help"); options.addOption(help); - Option depth = new Option("d", "depth", true, - "profondeur de l'arbre des ArchiveUnits (1 par défaut, min 1, max 128)"); + Option depth = new Option( + "d", + "depth", + true, + "profondeur de l'arbre des ArchiveUnits (1 par défaut, min 1, max 128)" + ); depth.setArgName("num"); options.addOption(depth); - Option number = new Option("n", "number", true, - "nombre d'objets de taille standard (0 par défaut, min 0, max 1000000)"); + Option number = new Option( + "n", + "number", + true, + "nombre d'objets de taille standard (0 par défaut, min 0, max 1000000)" + ); number.setArgName("num"); options.addOption(number); - Option size = new Option("s", "size", true, - "taille des objets standards en ko (100ko par défaut, min 1ko, max 1Go)"); + Option size = new Option( + "s", + "size", + true, + "taille des objets standards en ko (100ko par défaut, min 1ko, max 1Go)" + ); size.setArgName("num"); options.addOption(size); - Option bigNumber = new Option("N", "Number", true, - "nombre d'objets de grande taille (0 par défaut, min 0, max 100)"); + Option bigNumber = new Option( + "N", + "Number", + true, + "nombre d'objets de grande taille (0 par défaut, min 0, max 100)" + ); bigNumber.setArgName("num"); options.addOption(bigNumber); - Option bigSize = new Option("S", "Size", true, - "taille des gros objets en Mo (1Go par défaut, min 1Mo, max 1TO)"); + Option bigSize = new Option( + "S", + "Size", + true, + "taille des gros objets en Mo (1Go par défaut, min 1Mo, max 1TO)" + ); bigSize.setArgName("num"); options.addOption(bigSize); - Option random = new Option("r", "random", false, - "génère des contenus aléatoires (donc peu compressibles) dans les fichiers d'objets"); + Option random = new Option( + "r", + "random", + false, + "génère des contenus aléatoires (donc peu compressibles) dans les fichiers d'objets" + ); options.addOption(random); - Option text = new Option("t", "text", false, - "génère des contenus textuels (donc compressibles) dans les fichiers d'objets"); + Option text = new Option( + "t", + "text", + false, + "génère des contenus textuels (donc compressibles) dans les fichiers d'objets" + ); options.addOption(text); - Option zero = new Option("z", "zero", false, - "met uniquement des zéros dans les fichiers d'objets (contenu par défaut)"); + Option zero = new Option( + "z", + "zero", + false, + "met uniquement des zéros dans les fichiers d'objets (contenu par défaut)" + ); options.addOption(zero); - Option out = new Option("o", "out", true, - "nom du fichier de sortie (out.sip par défaut)"); + Option out = new Option("o", "out", true, "nom du fichier de sortie (out.sip par défaut)"); out.setArgName("FILE"); options.addOption(out); - Option word = new Option("w", "word", true, - "mot utilisé dans le titre des ArchiveUnits"); + Option word = new Option("w", "word", true, "mot utilisé dans le titre des ArchiveUnits"); word.setArgName("WORD"); options.addOption(word); - - Option generatedMetadatas = new Option("gm", "generated-metadatas", true, - "listes de metadonnées par leur nom seda présentes à la racine de la balise " - + "des unités archivistiques à générer automatiquement, séparées par des virgules. " - + "Seules les métadonnées de type 'texte' sont prises en compte."); + + Option generatedMetadatas = new Option( + "gm", + "generated-metadatas", + true, + "listes de metadonnées par leur nom seda présentes à la racine de la balise " + + "des unités archivistiques à générer automatiquement, séparées par des virgules. " + + "Seules les métadonnées de type 'texte' sont prises en compte." + ); generatedMetadatas.setArgName("gm"); options.addOption(generatedMetadatas); @@ -211,8 +243,7 @@ private static void extractOptionsOrExit(String[] args) { } catch (ParseException e) { exitHelp(1); } - if (cmd.hasOption("help")) - exitHelp(0); + if (cmd.hasOption("help")) exitHelp(0); if (cmd.hasOption("depth")) { depth = getIntOrExit("depth"); if ((depth < 1) || (depth > 128)) { @@ -250,31 +281,33 @@ private static void extractOptionsOrExit(String[] args) { } if (cmd.hasOption("out")) { out = cmd.getOptionValue("out"); - if (out == null) - exitHelp(1); + if (out == null) exitHelp(1); } if (cmd.hasOption("word")) { word = cmd.getOptionValue("word"); - if (word == null) - exitHelp(1); + if (word == null) exitHelp(1); } - if (cmd.hasOption("text")) - contentType = TEXT_CONTENT; - if (cmd.hasOption("random")) - contentType = RANDOM_CONTENT; - + if (cmd.hasOption("text")) contentType = TEXT_CONTENT; + if (cmd.hasOption("random")) contentType = RANDOM_CONTENT; + if (cmd.hasOption("gm")) { - String gms = cmd.getOptionValue("gm"); - if(StringUtils.isNotBlank(gms)) { - for(String metadata : StringUtils.split(gms, ",")) { - if (Content.metadataMap.containsKey(metadata) - && Content.metadataMap.get(metadata).getMetadataClass().getSimpleName().equals(StringType.class.getSimpleName())) { - generatedMetadatas.add(metadata); - } else { - System.out.println("Invalid metadata will not be generated: " + metadata); - } - } - } + String gms = cmd.getOptionValue("gm"); + if (StringUtils.isNotBlank(gms)) { + for (String metadata : StringUtils.split(gms, ",")) { + if ( + Content.metadataMap.containsKey(metadata) && + Content.metadataMap + .get(metadata) + .getMetadataClass() + .getSimpleName() + .equals(StringType.class.getSimpleName()) + ) { + generatedMetadatas.add(metadata); + } else { + System.out.println("Invalid metadata will not be generated: " + metadata); + } + } + } } } @@ -327,7 +360,9 @@ static String generateFile(Path onDiskPath, int blockNumber, int blockSize, int } return formatter.toString(); } catch (Exception e) { - System.out.println("Impossible d'encoder le hash du fichier [" + onDiskPath.toString() + "]->" + e.getMessage()); + System.out.println( + "Impossible d'encoder le hash du fichier [" + onDiskPath.toString() + "]->" + e.getMessage() + ); System.exit(1); } return null; @@ -352,31 +387,41 @@ static int getUniqNodeID() { * @param depth the tree depth to generate * @throws SEDALibException the seda lib exception */ - static void generateTree(SIPBuilder sb, String auName, int number, int bigNumber, int depth) throws SEDALibException { + static void generateTree(SIPBuilder sb, String auName, int number, int bigNumber, int depth) + throws SEDALibException { String childAuName; ArchiveUnit au; - if ((number == 0) && (bigNumber == 0)) - return; + if ((number == 0) && (bigNumber == 0)) return; if (depth == 0) { for (int i = 0; i < number; i++) { - String uniqueNodeId = Integer.toString(getUniqNodeID()); + String uniqueNodeId = Integer.toString(getUniqNodeID()); childAuName = "Leaf" + uniqueNodeId; - au = sb.addNewSubArchiveUnit(auName, childAuName, "Item", word + " " + childAuName, - "Description " + childAuName); - for (String metadataName: generatedMetadatas) { - au.getContent().addNewMetadata(metadataName, metadataName +"_" + uniqueNodeId); + au = sb.addNewSubArchiveUnit( + auName, + childAuName, + "Item", + word + " " + childAuName, + "Description " + childAuName + ); + for (String metadataName : generatedMetadatas) { + au.getContent().addNewMetadata(metadataName, metadataName + "_" + uniqueNodeId); } addKnownFileToArchiveUnit(au, onDiskStandardPath, standardFileDigest); } for (int i = 0; i < bigNumber; i++) { - String uniqueNodeId = Integer.toString(getUniqNodeID()); + String uniqueNodeId = Integer.toString(getUniqNodeID()); childAuName = "BigLeaf" + uniqueNodeId; - au = sb.addNewSubArchiveUnit(auName, childAuName, "Item", word + " " + childAuName, - "Description " + childAuName); - for (String metadataName: generatedMetadatas) { - au.getContent().addNewMetadata(metadataName, metadataName +"_" + uniqueNodeId); + au = sb.addNewSubArchiveUnit( + auName, + childAuName, + "Item", + word + " " + childAuName, + "Description " + childAuName + ); + for (String metadataName : generatedMetadatas) { + au.getContent().addNewMetadata(metadataName, metadataName + "_" + uniqueNodeId); } addKnownFileToArchiveUnit(au, onDiskBigPath, bigFileDigest); } @@ -385,15 +430,31 @@ static void generateTree(SIPBuilder sb, String auName, int number, int bigNumber if ((Math.floor(number / 2.0) > 0) || (Math.floor(bigNumber / 2.0) > 0)) { childAuName = "Node" + Integer.toString(getUniqNodeID()); - sb.addNewSubArchiveUnit(auName, childAuName, "RecordGrp", word + " " + childAuName, - "Description " + childAuName); + sb.addNewSubArchiveUnit( + auName, + childAuName, + "RecordGrp", + word + " " + childAuName, + "Description " + childAuName + ); generateTree(sb, childAuName, (int) Math.floor(number / 2.0), (int) Math.floor(bigNumber / 2.0), depth - 1); } if ((number - Math.floor(number / 2.0) > 0) || (bigNumber - Math.floor(bigNumber / 2.0) > 0)) { childAuName = "Node" + Integer.toString(getUniqNodeID()); - sb.addNewSubArchiveUnit(auName, childAuName, "RecordGrp", word + " " + childAuName, - "Description " + childAuName); - generateTree(sb, childAuName, (int) (number - Math.floor(number / 2.0)), (int) (bigNumber - Math.floor(bigNumber / 2.0)), depth - 1); + sb.addNewSubArchiveUnit( + auName, + childAuName, + "RecordGrp", + word + " " + childAuName, + "Description " + childAuName + ); + generateTree( + sb, + childAuName, + (int) (number - Math.floor(number / 2.0)), + (int) (bigNumber - Math.floor(bigNumber / 2.0)), + depth - 1 + ); } } @@ -407,8 +468,12 @@ static void generateTree(SIPBuilder sb, String auName, int number, int bigNumber * ArchiveUnit with the same UniqID */ static void addKnownFileToArchiveUnit(ArchiveUnit au, Path onDiskPath, String digest) throws SEDALibException { - BinaryDataObject bdo = new BinaryDataObject(au.getDataObjectPackage(), onDiskPath, onDiskPath.getFileName().toString(), - "BinaryMaster_1"); + BinaryDataObject bdo = new BinaryDataObject( + au.getDataObjectPackage(), + onDiskPath, + onDiskPath.getFileName().toString(), + "BinaryMaster_1" + ); putKnownTechnicalElements(bdo, digest); au.addDataObjectById(bdo.getInDataObjectPackageId()); } @@ -431,15 +496,20 @@ static void putKnownTechnicalElements(BinaryDataObject bdo, String digest) throw lfilename = bdo.getOnDiskPath().getFileName().toString(); llastModified = Files.getLastModifiedTime(bdo.getOnDiskPath()); } catch (IOException e) { - throw new SEDALibException("Impossible de générer les infos techniques pour le fichier [" + bdo.getOnDiskPath().toString() + "]\n->" + e.getMessage()); + throw new SEDALibException( + "Impossible de générer les infos techniques pour le fichier [" + + bdo.getOnDiskPath().toString() + + "]\n->" + + e.getMessage() + ); } - bdo.addMetadata(new DigestType("MessageDigest",digest,"SHA-512")); - bdo.addNewMetadata("Size",lsize); - if (contentType == TEXT_CONTENT) - bdo.addMetadata(new FormatIdentification("Plain Text File", "text/plain", "x-fmt/111", null)); - else - bdo.addNewMetadata("FormatIdentification","Unknown", null, null, null); + bdo.addMetadata(new DigestType("MessageDigest", digest, "SHA-512")); + bdo.addNewMetadata("Size", lsize); + if (contentType == TEXT_CONTENT) bdo.addMetadata( + new FormatIdentification("Plain Text File", "text/plain", "x-fmt/111", null) + ); + else bdo.addNewMetadata("FormatIdentification", "Unknown", null, null, null); FileInfo fileInfo = new FileInfo(); fileInfo.addNewMetadata("Filename", lfilename); @@ -459,20 +529,28 @@ public static void main(String[] args) { Path outPath = Paths.get(out).toAbsolutePath().normalize(); Path dirPath = outPath.getParent(); - if (dirPath == null) - dirPath = Paths.get("/"); + if (dirPath == null) dirPath = Paths.get("/"); onDiskStandardPath = dirPath.resolve("standardfile.tmp"); onDiskBigPath = dirPath.resolve("bigfile.tmp"); standardFileDigest = generateFile(onDiskStandardPath, size, 1024, contentType); bigFileDigest = generateFile(onDiskBigPath, bigSize, 1024 * 1024, contentType); - SEDALibProgressLogger spl = new SEDALibProgressLogger(LoggerFactory.getLogger("fr/gouv/vitam/tools/testsipgenerator"), SEDALibProgressLogger.OBJECTS_GROUP, null, 100); + SEDALibProgressLogger spl = new SEDALibProgressLogger( + LoggerFactory.getLogger("fr/gouv/vitam/tools/testsipgenerator"), + SEDALibProgressLogger.OBJECTS_GROUP, + null, + 100 + ); try (SIPBuilder sb = new SIPBuilder(outPath.toString(), spl)) { sb.setAgencies("FRAN_NP_000001", "FRAN_NP_000010", "FRAN_NP_000015", "FRAN_NP_000019"); sb.setArchivalAgreement("Accepte_les_objets_non_identifies"); - sb.createRootArchiveUnit("Root", "Subseries", "TestSIPRoot-" + word, - "Racine du SIP de test généré avec les arguments [" + String.join(" ", args) + "]"); + sb.createRootArchiveUnit( + "Root", + "Subseries", + "TestSIPRoot-" + word, + "Racine du SIP de test généré avec les arguments [" + String.join(" ", args) + "]" + ); generateTree(sb, "Root", number, bigNumber, depth - 1); sb.generateSIP(); } catch (SEDALibException e) { From b66c5f35dc03e98e69f3136804450b04c61d2dac Mon Sep 17 00:00:00 2001 From: Daniel Radeau Date: Fri, 6 Feb 2026 17:44:48 +0100 Subject: [PATCH 4/4] story #15307 ci: add license and linter checks --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6333515..b025b246 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: java-version: "17" - name: Build and Run Tests - run: mvn --settings .ci/github-actions-settings.xml verify + run: mvn --settings .ci/github-actions-settings.xml -Dspotless.check.skip verify env: JAVA_TOOL_OPTIONS: "-Duser.timezone=Europe/Paris" SERVICE_NEXUS_URL: ${{ secrets.SERVICE_NEXUS_URL }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..cd5469eb --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Lint +run-name: Linting branch ${{ github.ref }} +on: [push, pull_request] +jobs: + lint-java: + name: Lint Java + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "21" + - name: Restore maven cache + uses: actions/cache@v4 + with: + path: | + ~/.m2/repository + **/target/spotless-prettier-node-modules-* + key: maven-lint-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + - name: License and Format Check + run: mvn --settings .ci/github-actions-settings.xml -Pvitam -T1C license:check spotless:check + env: + SERVICE_NEXUS_URL: ${{ secrets.SERVICE_NEXUS_URL }} + CI_USR: ${{ secrets.CI_USR }} + CI_PSW: ${{ secrets.CI_PSW }}